예제 #1
0
 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'));
 }
예제 #2
0
 /**
  * Display a list of Vehicle's registration number
  * @return static
  */
 public function vehicle()
 {
     return Vehicles::all()->lists('registration', 'registration')->sort();
 }
예제 #3
0
 public function vehicleRegistrationExpire()
 {
     return Vehicles::where('registration_expire', '<', Carbon::now()->addDays(30))->count();
 }
예제 #4
0
 /**
  * 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'));
 }
예제 #5
0
 public function logVehicle($id)
 {
     return $id == 0 ? '' : Vehicles::findOrFail($id)->registration;
 }
예제 #6
0
 /**
  * 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']);
 }
예제 #7
0
 public function vehicles($eid)
 {
     $vehicle = Vehicles::all()->where('eid', $eid)->pluck('registration')->first();
     return $vehicle;
 }
예제 #8
0
 /**
  * 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 : '';
 }
예제 #9
0
 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);
 }