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