winter/modules/cms/routes.php
Marc Jauvin 9a6f71e0d4
Fix route order with new system.beforeRoute and system.route events (#465)
With the recent change to module routes being registered in their boot methods the Backend & CMS modules were registering their routes before the System module could. 

Due to the greedy nature of the CMS module's route it must always be registered last.
2022-02-21 12:28:09 -06:00

39 lines
887 B
PHP

<?php
Event::listen('system.route', function () {
/**
* Register CMS routes before all user routes.
*/
/**
* @event cms.beforeRoute
* Fires before cms routes get added
*
* Example usage:
*
* Event::listen('cms.beforeRoute', function () {
* // your code here
* });
*
*/
Event::fire('cms.beforeRoute');
/*
* The CMS module handles all URLs that have not already been handled by the other modules & plugins.
*/
Route::any('{slug?}', 'Cms\Classes\CmsController@run')->where('slug', '(.*)?')->middleware('web');
/**
* @event cms.route
* Fires after cms routes get added
*
* Example usage:
*
* Event::listen('cms.route', function () {
* // your code here
* });
*
*/
Event::fire('cms.route');
}, PHP_INT_MIN);