vipindasks

This is how I do it. In my controller I set a name and share it to the view

<?php namespace App\Http\Controllers\Admin;

use Auth;
use Validator;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;

class MyController extends Controller
{
    public function __construct()
    {
        View::share(['page_name_active'=> 'mypagename']);       
    }
    /* rest of logic */
}

And in my view, I check against the respective values and show active

                        <li class="@if($page_name_active=='mypagename')active @endif">
                            <a href="{{route('admin.mypage')}}" >My Page</a>
                        </li>

Return to Thread...