PHP code example of lucadello91 / laravel-active

1. Go to this page and download the library: Download lucadello91/laravel-active library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lucadello91 / laravel-active example snippets


'providers' => [
    Lucadello91\Active\LaravelActiveServiceProvider::class
];

'aliases' => [
    'Active'    => Lucadello91\Active\Facades\LaravelActive::class
];

<li>
    <a href="{{ route('home') }}" class="{{ Active::isActiveRoute('home') }}">
        <i class="halflings white home"></i> Home
    </a>
</li>

<li>
    <a href="#" class="{{ Active::areActiveRoutes(['murter', 'kornati']) }}">
        <i class="halflings white screenshot"></i> Location
    </a>
    <ul>
        <li>
            <a href="{{ route('murter') }}">Murter</a>
        </li>
        <li>
            <a href="{{ route('kornati') }}">Kornati</a>
        </li>
    </ul>
</li>

<li>
    <a href="{{ route('trips.index') }}" class="{{ Active::isActiveMatch('trips') }}">
        <i class="halflings white road"></i> Trips
    </a>
</li>

{{ Active::isActiveRoute('home') }}

{{ Active::isActiveRouteResourceName('home') }}

{{ Active::isActiveURL('/about') }}

{{ Active::isActiveMatch('bout') }}

{{ Active::areActiveRoutes(['product.index', 'product.show']) }}

{{ Active::areActiveRoutesResourcesNames(['post', 'comments']) }}

{{ Active::areActiveURLs(['/product', '/product/create']) }}