F
Filament10mo ago
Jay

How do I check the current route the user is on?

This used to work previously, but stopped after I ran composer update. if (request()->route()->getName() == 'filament.admin.resources.courses.view') { return [ RelationManagers\PreferencesRelationManager::class, ]; } else { return []; } It says "Call to a member function getName() on null"
Solution:
You can use Route::currentRouteName()
Jump to solution
3 Replies
Jay
Jay10mo ago
If not, can something tell me how to hide the relation using any other methods? I only want it to show in the infolist view page
Solution
Thijmen
Thijmen10mo ago
You can use Route::currentRouteName()
Jay
Jay10mo ago
Thanks!