Matching URL Segment :
<li class="{{ (request()->segment(2) == 'cities') ? 'active' : '' }}">
So, this one will match any URL like /admin/cities, /user/cities/edit etc.
Starting with the URL
<li class="{{ (request()->is('admin/cities*')) ? 'active' : '' }}">
/admin/cities/create or /admin/cities/1/edit.
Exact URL
<li class="{{ (request()->is('admin/cities')) ? 'active' : '' }}">
Probably, the most simple one – you just check the exact URL and see if it matches:
No comments:
Post a Comment