Skip to content

Instantly share code, notes, and snippets.

@LasseRafn
Last active June 12, 2017 07:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LasseRafn/65ef4f0424230cf9a387f5db81ab05a3 to your computer and use it in GitHub Desktop.
Save LasseRafn/65ef4f0424230cf9a387f5db81ab05a3 to your computer and use it in GitHub Desktop.
<?php
namespace App\Nav;
class NavItem {
public static function render($routeName, $text = '') {
return '<li' . ($routeName === \Route::currentRouteName() ? 'class="active"' : '') . '><a href="' . route($routeName) . '">' . $text . '</a></li>';
}
}
// Usage:
App\Nav\NavItem::render('vendor.products', 'Products');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment