Example #1
0
 /**
  * Outputs all the routes, including those added by modules
  */
 public function routes()
 {
     Route::group(array('prefix' => $this->config->get('coanda::coanda.admin_path')), function () {
         // All module admin routes should be wrapper in the auth filter
         Route::group(array('before' => 'admin_auth'), function () {
             foreach ($this->modules as $module) {
                 $module->adminRoutes();
             }
         });
         // We will put the main admin controller outside the group so it can handle its own filters
         Route::controller('/', 'CoandaCMS\\Coanda\\Controllers\\AdminController');
     });
     // Let the module output any front end 'user' routes
     foreach ($this->modules as $module) {
         $module->userRoutes();
     }
     App::before(function () {
         Route::match(['GET', 'POST'], 'search', function () {
             // Pass this route to the search provider, it can do whatever it likes!
             return Coanda::search()->handleSearch();
         });
         Route::match(['GET', 'POST'], '{slug}', function ($slug) {
             return Coanda::route($slug);
         })->where('slug', '[\\.\\/_\\-\\_A-Za-z0-9]+');
         Route::match(['GET', 'POST'], '/', function () {
             return Coanda::routeHome();
         });
     });
 }