Trigger an error in the router #815
-
How to correctly cause an error in the router? The documentation has this: https://wintercms.com/docs/services/router#throwing-404-errors My code: <?php
Route::get('test.txt', function ()
{
if ( Settings::get('active') ) {
// ...
}
else {
App::abort(404);
}
}); I get an exception (application error). |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
This error comes because of |
Beta Was this translation helpful? Give feedback.
-
If you would like to return a rendered 404 page as seen in the backend then you can do the following: return Response::make(View::make('backend::404'), 404); If you would like to return the 404 page as configured in the frontend then you can do the following: $controller = new Cms\Classes\Controller();
$controller->setStatusCode(404);
return $controller->run('404'); |
Beta Was this translation helpful? Give feedback.
If you would like to return a rendered 404 page as seen in the backend then you can do the following:
If you would like to return the 404 page as configured in the frontend then you can do the following: