Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel assign active based on route name


<li class="{{ Request::is('products*') ? 'active' : '' }}">

    <a href="{{ route('products.index') }}"><span>Products</span></a>

</li> 
Comment

laravel assign active based on route name


<li class = "{{ set_active('admin/users') }}">
    <a href="{{ url('/admin/users/') }}">Users</a>
</li> 
Comment

laravel assign active based on route name

function set_active( $route ) {
    if( is_array( $route ) ){
        return in_array(Request::path(), $route) ? 'active' : '';
    }
    return Request::path() == $route ? 'active' : '';
}
Comment

PREVIOUS NEXT
Code Example
Php :: laravel env production 
Php :: how to set field type of date of birth in laravel 
Php :: livewire pagination bootstrap 
Php :: composer remove cache 
Php :: encryption key has not encrypted laravel 
Php :: php artisan migrate reset 
Php :: apache not executing php 
Php :: default sort yii2 
Php :: convert date to reverse date in php 
Php :: php sql connection string 
Php :: magento 2 change customers password 
Php :: wait php 
Php :: php get first and last day of previous month 
Php :: wordpress add class on navigation menu 
Php :: magento 2 status mode 
Php :: check if date between two dates laravel eloquent 
Php :: get page name wp 
Php :: homebrew switch php version 
Php :: php grab month from date 
Php :: get post title by post id wordpress 
Php :: Laravel factory avatars 
Php :: repeater acf 
Php :: get the href in string regex php 
Php :: php extract zip 
Php :: symfony exclude class from autowiring 
Php :: twig for 
Php :: Yii2 Stripe Webhook testing: "[ERROR] Failed to Post" 
Php :: convert 1 digit to five digits laravel 
Php :: php remove space before and after string 
Php :: get current route laravel 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =