Determine if the current route matches a given name.
public static currentRouteNamed ( string $name ) : boolean | ||
$name | string | |
return | boolean |
function is_detailpage() { $routes = ['classrooms.discussiondetail', 'classrooms.assignmentdetail', 'classrooms.coursedetail', 'classrooms.moduledetail', 'classrooms.quizdetail']; foreach ($routes as $route) { if (Route::currentRouteNamed($route)) { return true; } } return false; }
// save the attempted url Session::put('attemptedUrl', URL::current()); return Redirect::route('getLogin'); } View::share('currentUser', Sentry::getUser()); }); Route::filter('notAuth', function () { if (Sentry::check()) { $url = Session::get('attemptedUrl'); if (!isset($url)) { $url = URL::route('indexDashboard'); } Session::forget('attemptedUrl'); return Redirect::to($url); } }); Route::filter('hasPermissions', function ($route, $request, $userPermission = null) { if (Route::currentRouteNamed('putUser') && Sentry::getUser()->id == Request::segment(3) || Route::currentRouteNamed('showUser') && Sentry::getUser()->id == Request::segment(3)) { } else { if ($userPermission === null) { $permission = Smartcms\Core\Services\Core\CoreService::getPermissionWithRoute(Route::current()->getName()); } else { $permission = $userPermission; } if ($permission) { if (!Sentry::getUser()->hasAccess($permission)) { return Redirect::route('accessDenied'); } } } });