Notifications
Clear all
BugOverflow
1
Posty
1
Users
0
Reactions
726
Widok
0
27/07/2021 7:13 pm
Topic starter
how to detect currently selected controller? (blade template)
1 Answer
0
27/07/2021 7:16 pm
Topic starter
- Create helper
- app/helpers.app
- register it inside composer.json
"autoload": { "psr-4": { "App\\": "app/", "Database\\Factories\\": "database/factories/", "Database\\Seeders\\": "database/seeders/" }, "files": [ "app/helpers.php" ] },
- Inside helpers.php
function isMenuItemSelected($url) { if (url()->current() == $url) return 'active'; return; }
-
how to detect currently active menu item
<a href="{{route('forms.index')}}" class="list-group-item list-group-item-action py-2 ripple {{isMenuItemSelected(route('forms.index'))}}" >