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