DEV Community

Mior Muhammad Zaki
Mior Muhammad Zaki

Posted on • Originally published at crynobone.com

By-passing Laravel Nova catch-all routes

Laravel Nova routes by default will register a catch-all route to intercept all GET requests and propagate it to Vue router.

However if you application need to define alternative catch-all routes as well for SPA or any other requirement you should be able to handle it via Laravel Fallback Routes

Route::fallback(function ($fallbackPlaceholder) {
    // ...
});
Enter fullscreen mode Exit fullscreen mode

If you need to more control instead of $fallbackPlaceholder, you need to register the route manually and ends with where() and fallback():

Route::get('/{locale}/{page}', function ($locale, $page) {
    // 
})->where('locale', 'en|es')->fallback();
Enter fullscreen mode Exit fullscreen mode

Top comments (0)