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
Your code is working fine, but you have to use it for every link that can be active. It is better to return only class name, not class="..."
so you can add other classes.
Be careful when using *
at the end (about*
). If you use /*
for home page then it will always be marked as active (because every other page starts with /
).
You can also move {{ Request::is('/') ? 'active' : '' }}
to helper function/method.