Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- |--------------------------------------------------------------------------
- | Detect Active Route
- |--------------------------------------------------------------------------
- |
- | Compare given route with current route and return output if they match.
- | Very useful for navigation, marking if the link is active.
- |
- */
- function isActiveRoute($route, $cssClass = "active")
- {
- //if (strpos(Route::currentRouteName(), $route) !== false)
- if (Route::currentRouteName() == $route)
- return $cssClass;
- }
- /*
- |--------------------------------------------------------------------------
- | Detect Active Routes
- |--------------------------------------------------------------------------
- |
- | Compare given routes with current route and return output if they match.
- | Very useful for navigation, marking if the link is active.
- |
- */
- function areActiveRoutes(Array $routes, $cssClass = "active")
- {
- foreach ($routes as $route)
- {
- if (Route::currentRouteName() == $route)
- return $cssClass;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement