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