Setting Bootstrap navbar active class in Laravel 5

前端 未结 13 2053
温柔的废话
温柔的废话 2020-12-23 16:34

I\'ve been wondering around looking for solutions, but can\'t really understand especially when creating helpers. I\'m new in Laravel and I want a simple or if not a detaile

13条回答
  •  天命终不由人
    2020-12-23 17:08

    The solution given by @Daniel Antos is best answer, as I have found. Mr. Danial Antos also warned about using * at the end (about*). Because while using /* for home page then it is always marked as active (because every other page starts with /). So, I have used as follows and it worked fine for me:

    {{ (Request::is('users') || Request::is('users/*') ? 'active open' : '') }}
    

提交回复
热议问题