public function index() { $title = 'HOME'; $repository = $this->repository; $employees = Employee::where('license_expire', '<', Carbon::now()->addDays(30))->orWhere('visa_expire', '<', Carbon::now()->addDays(30))->get(); $vehicles = Vehicles::where('registration_expire', '<', Carbon::now()->addDays(30))->get(); return view('pages.home', compact('title', 'employees', 'vehicles', 'repository')); }
/** * Display a list of Vehicle's registration number * @return static */ public function vehicle() { return Vehicles::all()->lists('registration', 'registration')->sort(); }
public function vehicleRegistrationExpire() { return Vehicles::where('registration_expire', '<', Carbon::now()->addDays(30))->count(); }
/** * Show vehicle log from storage * Created by smartrahat Date: 21.11.2015 Time: 08:32PM * @param $id * @return \Illuminate\View\View */ public function vehicleLog($id) { $vehicle = Vehicles::findOrFail($id); $logs = Log::where('bid', $id)->orderBy('date', 'desc')->orderBy('id', 'desc')->get(); $title = 'Vehicle Log'; $repository = $this->repository; return view('vehicle.vehicleLog', compact('title', 'logs', 'vehicle', 'repository')); }
public function logVehicle($id) { return $id == 0 ? '' : Vehicles::findOrFail($id)->registration; }
/** * Store Vehicle information associated with drivers * @param Request $request * Created by smartrahat Date: 04.11.2015 Time: 02:35PM * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function changeVehicle(Request $request) { $request['action'] = 'Add'; $request['e_description'] = 'Assign bus'; $request['b_description'] = 'Assign driver'; Log::create($request->all()); $vehicle = Vehicles::query()->findOrFail($request['bid']); $vehicle->update($request->only('eid')); return redirect('employee/' . $request['eid']); }
public function vehicles($eid) { $vehicle = Vehicles::all()->where('eid', $eid)->pluck('registration')->first(); return $vehicle; }
/** * Created by smartrahat Date: 03.12.2015 Time: 05:43AM * @param $id * @return mixed */ public function currentVehicle($id) { $vehicle = Vehicles::all()->where('eid', $id)->sortByDesc('updated_at')->first(); return $vehicle != null ? $vehicle->registration : ''; }
public function removeVehicle(Request $request) { $redirect = $request['cid']; $request['c_description'] = 'Bus removed'; $request['b_description'] = 'Removed form client'; $request['action'] = 'Remove'; Log::create($request->all()); // update log $vehicle = Vehicles::findOrFail($request['bid']); $request['cid'] = 0; $vehicle->update($request->only(['cid'])); // update vehicle's foreign key return redirect('client/' . $redirect); }