Laravel-RouteServiceProvider.php中的访问中间件

问题描述 投票:0回答:1

我需要分离后端和前端路由。为此,我在\routes目录中为后端和前端创建了两个不同的文件。在RouteServiceProvider.php中,我想知道当前用户是谁,以便加载其路由。我尝试过此

public function map()
{
    $this->mapApiRoutes();

    $this->mapWebRoutes();

    //
}

protected function mapWebRoutes()
{

    Route::middleware('auth')
         ->namespace($this->namespace)
         ->group(base_path('routes/backend.php'));
}

要加载中间件auth的路由,但它不起作用。我该怎么办?

php laravel laravel-5.6
1个回答
0
投票

将此文件添加到您的配置文件夹https://github.com/laravel/laravel/blob/develop/config/logging.php

并将其添加到您的.env文件LOG_CHANNEL = stack

PHP artisan config:cache

© www.soinside.com 2019 - 2024. All rights reserved.