zengine / active-route
Active route detection for laravel
This package's canonical repository appears to be gone and the package has been frozen as a result.
Requires
- php: ^7.1
- illuminate/routing: 5.6.*|5.7.*|5.8.*|^6.0
- illuminate/support: 5.6.*|5.7.*|5.8.*|^6.0
Requires (Dev)
- orchestra/testbench: 3.8.*
- phpunit/phpunit: ^7.3 || ^8.2
This package is auto-updated.
Last update: 2023-03-05 15:18:00 UTC
README
Easily detect if a route or url is the current.
Installation
You can install the package via composer:
composer require zengine/active-route
Usage
By default the helper returns active
if the route is the current.
<a href="{{ route('home') }}" class="btn {{ isActiveRoute('home') }}">Link</a>
You can pass a string to return if the route is the current.
<a href="{{ route('home') }}" class="btn {{ isActiveRoute('home', 'bg-red-300 rounded no-underline') }}">Link</a>
Check for multiple routes
<a href="{{ route('items') }}" class="btn {{ areActiveRoutes(['home', 'items']) }}">Link</a>
Check for wildcards as well
<a href="{{ route('items.creat') }}" class="btn {{ isActiveRoute('items.*') }}">Link</a>
Check for a url string
<a href="/calendar?date=2019-02-12" class="btn {{ isActiveUrl('calendar?date=2019-02-12') }}">Link</a>
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email christian@zenigne.org instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.