laravel8脚手架引起的关于ServiceProvider执行顺序的疑惑,请大佬能帮忙解惑下,谢谢

初衷

我想自定义实现用户的登录认证,原来使用的laravel脚手架程序(laravel\fortify)

步骤

首先移除脚手架自带的路由,从 \vendor\laravel\fortify\src\FortifyServiceProvider.php 中发现如下代码:

class FortifyServiceProvider extends ServiceProvider
{
    ...
    public function boot()
    {
        $this->configurePublishing();
        $this->configureRoutes();
    }
    ...
    protected function configureRoutes()
    {
        if (Fortify::$registersRoutes) {
            Route::group([
                'namespace' => 'Laravel\Fortify\Http\Controllers',
                'domain' => config('fortify.domain', null),
                'prefix' => config('fortify.path'),
            ], function () {
                $this->loadRoutesFrom(__DIR__.'/../routes/routes.php');
            });
        }
    }
}

\vendor\laravel\fortify\src\Fortify.php 类中有如下代码

class Fortify
{
    ...
    public static $registersRoutes = true;
    ...
    public static function ignoreRoutes()
    {
        static::$registersRoutes = false;

        return new static;
    }
}

所以我在App\Providers\AppServiceProvider 中调用 ignoreRoutes()方法,如下:

class AppServiceProvider extends ServiceProvider
{
    ...
    public function boot()
    {
        Fortify::ignoreRoutes();
    }
}

执行结果:脚手架的路由依旧生效,打印跟踪发现先执行的 FortifyServiceProvider 类中的 boot 方法,然后才执行的 AppServiceProvider 中的 boot 方法,即在我忽略路由的时候,路由已经注册好了。

问题

1.这是脚手架程序的BUG还是我调用 Fortify::ignoreRoutes() 的位置不对。
2.laravel中多个 ServiceProvider 中的 boot() 方法有没执行顺序,或者哪个是最先执行

感谢大佬帮忙答疑

《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!