repository = $block; parent::__construct(); } /** * Show block's list. * * @param string $slug * * @return response */ protected function index() { $blocks = $this->repository->scopeQuery(function($query){ return $query->orderBy('id','DESC'); })->paginate(); return $this->theme->of('blocks::public.block.index', compact('blocks'))->render(); } /** * Show block. * * @param string $slug * * @return response */ protected function show($slug) { $block = $this->repository->scopeQuery(function($query) use ($slug) { return $query->orderBy('id','DESC') ->where('slug', $slug); })->first(['*']); return $this->theme->of('blocks::public.block.show', compact('block'))->render(); } }