laravel 先後臺分離

# /data/www/php7.plearnu.com/app/Providers/RouteServiceProvider.php
protected $frontendNamespace = 'Plearnu\Http\Frontend\Controllers';

    protected $adminNamespace = 'Plearnu\Http\Admin\Controlers';

    /**
     * Define your route model bindings, pattern filters, etc.
     *
     * @param  \Illuminate\Routing\Router  $router
     * @return void
     */
    public function boot(Router $router)
    {
        //

        parent::boot($router);
    }

    /**
     * Define the routes for the application.
     *
     * @param  \Illuminate\Routing\Router  $router
     * @return void
     */
    public function map(Router $router)
    {
        $router->group(['namespace' => $this->frontendNamespace], function ($router) {
            require app_path('Http/Frontend/routes.php');
        });

        $router->group(['namespace' => $this->adminNamespace], function ($router) {
            require app_path('Http/Admin/routes.php');
        });
    }

實現 先後臺分離,共用php

相關文章
相關標籤/搜索