0

I'm trying to do what language is included in it added class"active"

I try this way but it doesn't work for me

    <div class="lang">
       <ul>
           @foreach(LaravelLocalization::getSupportedLocales() as $localeCode => $properties)
              <li>
                  <a 
                      class="{{ Request::path() === LaravelLocalization::getLocalizedURL() ? 'active' : ''}}"
                      rel="alternate"
                      hreflang="{{ $localeCode }}"
                      href="{{ LaravelLocalization::getLocalizedURL($localeCode, null, [], true) }}">
                      {{ $properties['native'] }}
                  </a>                                    
              </li>
           @endforeach
       </ul>
     </div>
Arthur
  • 385
  • 3
  • 13

1 Answers1

2

You should do:

{{ $localeCode == LaravelLocalization::getCurrentLocale() ? 'active' : ''}}
Tony
  • 401
  • 3
  • 8