How check the route loaded in radicle?

In AssetsServiceProvider.php I would like to load another stylesheet depending the route, the current page is loaded with bundle(‘app’)->enqueue();

I added a rout group in web.php

Route::prefix('tool')->group(function () {
    Route::get('/dashboard', function () {
        return view('tool', ['app_view' => 'dashboard']);
    });
}

Now if this group is used, I would like to load
bundle('tool')->enqueue(); instead bundle('app')->enqueue();

Is there any function or other way to check for the route?

I don’t know if it is the proper way, but this did it for me:

if (\Request::is('too/*')) {
      bundle('tool')->enqueue();
} else {
      bundle('app')->enqueue();
}
1 Like