repository = $task; parent::__construct(); } /** * Show task's list. * * @param string $slug * * @return response */ protected function index() { $tasks = $this->repository ->pushCriteria(app('Litepie\Repository\Criteria\RequestCriteria')) ->scopeQuery(function($query){ return $query->orderBy('id','DESC'); })->paginate(); return $this->response->title(trans('$timesheet::$task.names')) ->view('$timesheet::public.task.index') ->data(compact('$tasks')) ->output(); } /** * Show task's list based on a type. * * @param string $slug * * @return response */ protected function list($type = null) { $tasks = $this->repository ->pushCriteria(app('Litepie\Repository\Criteria\RequestCriteria')) ->scopeQuery(function($query){ return $query->orderBy('id','DESC'); })->paginate(); return $this->response->title(trans('$timesheet::$task.names')) ->view('$timesheet::public.task.index') ->data(compact('$tasks')) ->output(); } /** * Show task. * * @param string $slug * * @return response */ protected function show($slug) { $task = $this->repository->scopeQuery(function($query) use ($slug) { return $query->orderBy('id','DESC') ->where('slug', $slug); })->first(['*']); return $this->response->title($$task->name . trans('$timesheet::$task.name')) ->view('$timesheet::public.task.show') ->data(compact('$task')) ->output(); } }