<?php namespace Sahbaj\Sahbaj\Http\Controllers; use App\Http\Controllers\PublicWebController as PublicController; use Sahbaj\Sahbaj\Interfaces\SahbajRepositoryInterface; class SahbajPublicWebController extends PublicController { /** * Constructor. * * @param type \Sahbaj\Sahbaj\Interfaces\SahbajRepositoryInterface $sahbaj * * @return type */ public function __construct(SahbajRepositoryInterface $sahbaj) { $this->repository = $sahbaj; parent::__construct(); } /** * Show sahbaj's list. * * @param string $slug * * @return response */ protected function index() { $sahbajs = $this->repository->scopeQuery(function($query){ return $query->orderBy('id','DESC'); })->paginate(); return $this->theme->of('sahbaj::public.sahbaj.index', compact('sahbajs'))->render(); } /** * Show sahbaj. * * @param string $slug * * @return response */ protected function show($slug) { $sahbaj = $this->repository->scopeQuery(function($query) use ($slug) { return $query->orderBy('id','DESC') ->where('slug', $slug); })->first(['*']); return $this->theme->of('sahbaj::public.sahbaj.show', compact('sahbaj'))->render(); } }