middleware('web'); $this->setupTheme(config('theme.themes.public.theme'), config('theme.themes.public.layout')); $this->repository = $item; parent::__construct(); } /** * Show item's list. * * @param string $slug * * @return response */ protected function index() { $items = $this->repository ->pushCriteria(new \Assetdocs\Item\Repositories\Criteria\ItemPublicCriteria()) ->scopeQuery(function($query){ return $query->orderBy('id','DESC'); })->paginate(); return $this->theme->of('item::public.item.index', compact('items'))->render(); } /** * Show item. * * @param string $slug * * @return response */ protected function show($slug) { $item = $this->repository->scopeQuery(function($query) use ($slug) { return $query->orderBy('id','DESC') ->where('slug', $slug); })->first(['*']); return $this->theme->of('item::public.item.show', compact('item'))->render(); } }