Smiley Happy Coder

Lyle Barras

Lyle is Smiley Happy Coder

Developing for the web since 1999, that's 19 years

Laravel debugbar not loading with a catchall route

Recently I’ve been building an application that has a catchall route at the bottom of my routes file.
This is there to generate the pages that make up the frontend of the application as they all have dynamic URL’s

My problem comes when I try to use the debugbar
It seems that the debugbar loads up some JavaScript and CSS of its own.
The issue is that my catchall route, catches the requests to the JavaScript and CSS and, since it doesn’t know what they are, it fails.

One solution might be to load the JavaScript and CSS from a view but then I don’t really want them loaded all the time.

I found a better solution.

My original route looked like this


Route::any('{catchall?}', function() {
// ....
})->where('catchall', '(.*)');

All I needed to do was to add the debudbar to the patten so that these routes are ignored but the catchall route.


Route::any('{catchall?}', function() {
// ....
})->where('catchall', '(?!_debugbar\/).+');

  • Top

Read all my posts