框架安装了 laravel-admin 后是怎么路由到 admin 的?

本人新手,laravel5.5 安装了 laravel-admin 之后是怎么找到 admin 路由的呢?

我看/routes/web.php里面没有变化,文件app/Providers/RouteServiceProvider.php也没有改变。

我应该从哪里入手?没有思路

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

laravel-admin 的扩展包中的 AdminServiceProvider 里,boot 方法注册了路由

class AdminServiceProvider extends ServiceProvider
{
    ...

    /**
     * Boot the service provider.
     *
     * @return void
     */
    public function boot()
    {
       ...

        if (file_exists($routes = admin_path('routes.php'))) {
            $this->loadRoutesFrom($routes);
        }

        ...
    }

   ...
}

然后扩展包的 composer.json 里配置了对应的代码,框架会根据配置自动发现provider 而不用手动注册

"extra": {
        "laravel": {
            "providers": [
                "Encore\\Admin\\AdminServiceProvider"
            ],
            "aliases": {
                "Admin": "Encore\\Admin\\Facades\\Admin"
            }
        }
}
6个月前 评论
讨论数量: 2

laravel-admin 的扩展包中的 AdminServiceProvider 里,boot 方法注册了路由

class AdminServiceProvider extends ServiceProvider
{
    ...

    /**
     * Boot the service provider.
     *
     * @return void
     */
    public function boot()
    {
       ...

        if (file_exists($routes = admin_path('routes.php'))) {
            $this->loadRoutesFrom($routes);
        }

        ...
    }

   ...
}

然后扩展包的 composer.json 里配置了对应的代码,框架会根据配置自动发现provider 而不用手动注册

"extra": {
        "laravel": {
            "providers": [
                "Encore\\Admin\\AdminServiceProvider"
            ],
            "aliases": {
                "Admin": "Encore\\Admin\\Facades\\Admin"
            }
        }
}
6个月前 评论

在app下Admin目录

6个月前 评论

laravel-admin 的扩展包中的 AdminServiceProvider 里,boot 方法注册了路由

class AdminServiceProvider extends ServiceProvider
{
    ...

    /**
     * Boot the service provider.
     *
     * @return void
     */
    public function boot()
    {
       ...

        if (file_exists($routes = admin_path('routes.php'))) {
            $this->loadRoutesFrom($routes);
        }

        ...
    }

   ...
}

然后扩展包的 composer.json 里配置了对应的代码,框架会根据配置自动发现provider 而不用手动注册

"extra": {
        "laravel": {
            "providers": [
                "Encore\\Admin\\AdminServiceProvider"
            ],
            "aliases": {
                "Admin": "Encore\\Admin\\Facades\\Admin"
            }
        }
}
6个月前 评论

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