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