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