コード例 #1
0
 public function obtenerDatosPlanillaEspecial($central_id, $planilla_id)
 {
     $planilla = PlanillaEspecial::find($planilla_id);
     $planilla['tipo'] = 'especial';
     $planilla->load('viaje.conductor', 'central');
     return JsonResponse::create($planilla);
 }
コード例 #2
0
 public function getPlanilla($central_id, $planilla_id)
 {
     $tipoEmpresa = $this->verificartipoCentral($central_id);
     if ($tipoEmpresa->empresa->tipo == '1') {
         $planilla = PlanillaEspecial::find($planilla_id);
         $planilla['tipo'] = 'especial';
         $planilla->load('viaje.conductor', 'central');
         return JsonResponse::create($planilla);
     } else {
         $planilla = Planilla::find($planilla_id);
         $planilla['tipo'] = 'normal';
         $planilla->load('viaje.conductor', 'central.ciudad.departamento');
         return JsonResponse::create($planilla);
     }
 }
コード例 #3
0
 public function crearPlanillaEspecial($viaje_id, $central_id)
 {
     $planilla = new PlanillaEspecial();
     $planilla->viaje_id = $viaje_id;
     $planilla->central_id = $central_id;
     $planilla->numero_planilla = $this->generarNumeroPlanillaEspecial($central_id);
     if ($planilla->save()) {
         $planilla['tipo'] = 'especial';
         return $planilla;
     } else {
         $planilla->delete();
         return JsonResponse::create('Error al crear la planilla');
     }
 }