diff --git a/app/TeenQuotes/AdminPanel/AdminPanelServiceProvider.php b/app/TeenQuotes/AdminPanel/AdminPanelServiceProvider.php index d6353202..e832a003 100644 --- a/app/TeenQuotes/AdminPanel/AdminPanelServiceProvider.php +++ b/app/TeenQuotes/AdminPanel/AdminPanelServiceProvider.php @@ -12,6 +12,7 @@ namespace TeenQuotes\AdminPanel; use Illuminate\Support\ServiceProvider; +use TeenQuotes\AdminPanel\Helpers\Moderation; class AdminPanelServiceProvider extends ServiceProvider { @@ -33,13 +34,15 @@ public function register() private function registerRoutes() { - $this->app['router']->pattern('decision', 'approve|unapprove|alert'); + $this->app['router']->pattern('decision', Moderation::presentAvailableTypes()); - $this->app['router']->group($this->getRouteGroupParams(), function () { - $this->app['router']->get('/', ['uses' => $this->getController().'@index', 'as' => 'admin.quotes.index']); - $this->app['router']->get('edit/{quote_id}', ['uses' => $this->getController().'@edit', 'as' => 'admin.quotes.edit']); - $this->app['router']->put('update/{quote_id}', ['uses' => $this->getController().'@update', 'as' => 'admin.quotes.update']); - $this->app['router']->post('moderate/{quote_id}/{decision}', ['uses' => $this->getController().'@postModerate', 'as' => 'admin.quotes.moderate']); + $controller = $this->getController(); + + $this->app['router']->group($this->getRouteGroupParams(), function () use ($controller) { + $this->app['router']->get('/', ['uses' => $controller.'@index', 'as' => 'admin.quotes.index']); + $this->app['router']->get('edit/{quote_id}', ['uses' => $controller.'@edit', 'as' => 'admin.quotes.edit']); + $this->app['router']->put('update/{quote_id}', ['uses' => $controller.'@update', 'as' => 'admin.quotes.update']); + $this->app['router']->post('moderate/{quote_id}/{decision}', ['uses' => $controller.'@postModerate', 'as' => 'admin.quotes.moderate']); }); } diff --git a/app/TeenQuotes/AdminPanel/Helpers/Moderation.php b/app/TeenQuotes/AdminPanel/Helpers/Moderation.php index a78bd4e6..538ebf9e 100644 --- a/app/TeenQuotes/AdminPanel/Helpers/Moderation.php +++ b/app/TeenQuotes/AdminPanel/Helpers/Moderation.php @@ -69,7 +69,7 @@ public static function getAvailableTypes() * * @return string */ - private function presentAvailableTypes() + public static function presentAvailableTypes() { return implode('|', self::getAvailableTypes()); }