Skip to content

Instantly share code, notes, and snippets.

@oxyberg
Last active July 5, 2016 09:30
Show Gist options
  • Save oxyberg/7705558 to your computer and use it in GitHub Desktop.
Save oxyberg/7705558 to your computer and use it in GitHub Desktop.
Laravel 4 hack for detecting current menu item.
<?php
function menu($url) {
if (preg_match('#' . URL::to($url) . '#', URL::current())) return 'class="active"';
}
@oxyberg
Copy link
Author

oxyberg commented Nov 29, 2013

Usage:

<a href="{{ URL::to ('store') }}"{{ menu ('store/*') }}>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment