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.

1.1.0 2019-09-05 06:57 UTC

This package is auto-updated.

Last update: 2023-03-05 15:18:00 UTC


README

Latest Stable Version Latest Unstable Version Build Status Scrutinizer Code Quality Total Downloads StyleCI

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.