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