public function getProfile() { $users = \App\User::select('id', 'name')->where('id', '!=', \Auth::user()->id)->get(); $resHours = count(\App\ReservedHours::where('user_id', \Auth::user()->id)->get()); $finHours = count(\App\FinishedHour::where('user_id', \Auth::user()->id)->get()); return view('users.index', ['users' => $users, 'resHours' => $resHours, 'finHours' => $finHours]); }
public function postFinishedtask() { $reservedhour = \App\ReservedHours::find(\Request::input('hour_id')); \App\FinishedHour::create(array('user_id' => $reservedhour->user_id, 'service_id' => $reservedhour->service_id, 'client' => $reservedhour->client, 'price' => $reservedhour->service->price, 'created_at' => date('Y-m-d'))); \DB::table('reservedhours')->where('id', '=', $reservedhour->id)->delete(); return 'true'; }