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