Php LAVEL当前路由属于哪个路由组

Php LAVEL当前路由属于哪个路由组,php,laravel-5.5,Php,Laravel 5.5,我正在使用Laravel 5.5,想知道当前路由是否属于auth:web中间件组。有办法得到这个吗 我的路线: /*********************************************************************************************************************** * Guest routes ********************************************************

我正在使用
Laravel 5.5
,想知道当前路由是否属于
auth:web
中间件组。有办法得到这个吗

我的路线:

/***********************************************************************************************************************
 * Guest routes
 **********************************************************************************************************************/
Route::group([
    'middleware' => ['guest']
], function () {

    Route::get("login", "Auth\LoginController@showLoginForm")->name("user.login");
    Route::post("login", "Auth\LoginController@login")->name("user.do-login");
..................    
});

/***********************************************************************************************************************
 * All routes that require AUTH
 **********************************************************************************************************************/
Route::group([
    'middleware' => ['auth:user']
], function () {
..............
});
像下面这样。注意:我想要
用户的
路由组
而不是
身份验证

$request()->currentRoute()->isGuest();
这可能吗?我似乎在
Laravel
文档中找不到这一点


我试图在所有
guest
route页面上执行弹出模式,而不必检查和维护要测试的路由列表。谢谢。

用变通方法修复了它。添加了
web.
app.
所有路线名称的前缀,现在我搜索这个

@if(substr(\Request::route()->getName(), 0, 4) !== 'web.')
    @include('org.popupmsg.modal-pop')
@endif

现在路由已更改为:
web.user.login

您可以修改来宾中间件类
\App\Http\middleware\RedirectIfAuthenticated
中的
句柄
方法,类似于:

public function handle($request, Closure $next, $guard = null)
{
    // share a token to all views for this middleware:
    View::share('is_guest_route', true);  // <-- this line is added

    if (Auth::guard($guard)->check()) {
        return redirect('/home');
    }

    return $next($request);
}
在文件的“使用”部分中

现在,在每个视图(刀片文件)中,您都可以执行以下操作:

@if (isset($is_guest_route))
    // do whatever is needed for guest routes
@endif

路由名称不应更改。因此,这可能不是区分中间产品的正确位置。每次要更改路由的中间件集时,您可能会后悔在路由名称前加前缀。
@if (isset($is_guest_route))
    // do whatever is needed for guest routes
@endif