public function getIndex() { $users = User::all(); $entities = Semantics::GetAllEntities(); $logs = Log::all()->sortByDesc('created_at')->forPage(1, self::NB_LOGS_SHOWN); $comments = Comments::LoadComment(); $cComments = collect($comments); $data = array('users' => $users, 'entities' => $entities, 'logs' => $logs, 'comments' => $comments, 'nbCommentNotValidated' => $cComments->where("validated", false)->count()); return view('admin/admin')->with($data); }
/** * Display the specified resource. * Last updated by smartrahat Date: 29.11.2015 Time: 05:51PM * @param int $id * @return Response */ public function show($id) { $title = 'SHOW VEHICLE'; $vehicle = Vehicles::findOrFail($id); $client = Client::all()->where('id', $vehicle->cid)->sortByDesc('updated_at')->first(); $driver = Employee::all()->where('id', $vehicle->eid)->sortByDesc('updated_at')->first(); $fitness = Log::all()->where('action', 'Fitness Check')->where('bid', $vehicle->id)->last(); $police = Log::all()->where('action', 'Police Case')->where('bid', $vehicle->id)->sortByDesc('updated_at')->count(); $accident = Log::all()->where('action', 'Accident')->where('bid', $vehicle->id)->sortByDesc('updated_at')->count(); //dd($accident); $repository = $this->repository; return view('vehicle.show', compact('title', 'vehicle', 'driver', 'client', 'status', 'repository', 'fitness', 'police', 'accident')); }
/** * Display records of a specified driver. * * @param int $id * @return \Illuminate\View\View */ public function show($id) { $employee = Employee::query()->findOrFail($id); $title = $employee['name']; $client = Client::all()->where('id', $employee['cid'])->sortByDesc('updated_at')->first(); $vehicle = Vehicles::all()->where('eid', $employee['id'])->sortByDesc('updated_at')->first(); $police = Log::all()->where('action', 'Police Case')->where('eid', $employee['id'])->sortByDesc('updated_at')->count(); $accident = Log::all()->where('action', 'Accident')->where('eid', $employee['id'])->sortByDesc('updated_at')->count(); $repository = $this->repository; return view('employee.show', compact('title', 'employee', 'vehicle', 'client', 'status', 'repository', 'accident', 'police')); }
public function postDeleteLog() { Log::truncate(); return response()->json(['result' => Log::all()->count() == 0]); }