izniburak / php-router

PHP Router, which also has rich features like Middlewares and Controllers is simple, useful and flexible router class for PHP.
https://github.com/izniburak/php-router/wiki
MIT License
238 stars 45 forks source link

Group specific error pages #54

Closed mertgibi closed 3 years ago

mertgibi commented 3 years ago

How can I make a dashboard group specific error page? Also how can I use a controller in an error callback

my code

$app->router->get('/', function() {
    return 'Hello world';
}');

$app->router->group('/dashboard', function($router){

    $router->get('/', function(){
        return 'Dashboard page';
    });

    $router->error(function() {
        die('Not found dashboard page');
    });
});

$app->router->error(function() {
    die('Not found this page');
});

use callback

$app->router->error('Home@not_found');
izniburak commented 3 years ago

Hi @Venloress , There is no way to do this right now. But we can add a feature like that in next versions.