Created
June 15, 2016 10:08
-
-
Save thomasruiz/ad1bd945323f2f256afc94039a60595b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# partials/activeLink.blade.php | |
<?php | |
if (! isset($liCssClass)) { | |
$liCssClass = ''; | |
} | |
if (URL::current() === $url) { | |
$liCssClass .= ' active'; | |
} | |
if (! empty($liCssClass)) { | |
$liCSsClass = 'class="'. trim($liCssClass) .'"'; | |
} | |
?> | |
<li {{ $liCssClass }}> | |
<a href="{{ $url }}" {{ $aCssClass }}>{{ $text }}</a> | |
</li> | |
# your/view.blade.php | |
@include('_partials/activeLink', [ | |
'liCssClass' => 'custom classes in li', | |
'aCssClass' => 'custom classes in a', | |
'url' => route('your.url'), | |
'text' => 'Check this out' | |
]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment