Sat. Apr 4th, 2026
<nav>
    <a href="{{ route('admin.dashboard') }}" 
       class="py-2.5 px-4 rounded transition duration-200 hover:bg-gray-700 hover:text-white flex items-center
       {{ request()->routeIs('admin.dashboard') ? 'bg-gray-700 text-white' : 'text-gray-300' }}">
        <i class="fas fa-home mr-2"></i>
        Dashboard
    </a>

    <a href="{{ route('admin.addpost') }}" 
       class="py-2.5 px-4 rounded transition duration-200 hover:bg-gray-700 hover:text-white flex items-center
       {{ request()->routeIs('admin.addpost') ? 'bg-gray-700 text-white' : 'text-gray-300' }}">
        <i class="fas fa-users mr-2"></i>
        Add-Post
    </a>

    <a href="#" 
       class="py-2.5 px-4 rounded transition duration-200 hover:bg-gray-700 hover:text-white flex items-center
       {{ request()->routeIs('products') ? 'bg-gray-700 text-white' : 'text-gray-300' }}">
        <i class="fas fa-shopping-cart mr-2"></i>
        Products
    </a>
</nav>

basically we are using

{{ request()->routeIs('admin.dashboard') ? 'bg-gray-700 text-white' : 'text-gray-300' }}

at the end of the tailwind class

Leave a Reply

Your email address will not be published. Required fields are marked *