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