/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $conductor = Conductor::find($id); if (!$conductor) { $conductor = Conductor::where('identificacion', $id)->first(); if (!$conductor) { return response()->json(array("message" => 'No se encontro el conductor'), 400); } } return $conductor->load('empresa'); // $empresa = Empresa::select('id', 'nombre')->where('id', $conductor->empresa_id)->first(); // $conductor->empresa()->associate($empresa); }
public function bpasajeros($central_id) { return JsonResponse::create(Conductor::where(['estado' => 'En ruta', 'central_id' => $central_id, 'activo' => 1])->count()); }
public function verificarConductor($identificacion) { return Conductor::where('identificacion', $identificacion)->first(); }