2017-06-09 02:28:26 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
2018-02-21 12:33:09 +08:00
|
|
|
use Illuminate\Support\Facades\Route;
|
2017-06-09 02:28:26 +08:00
|
|
|
|
|
|
|
class RouteServiceProvider extends ServiceProvider
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* This namespace is applied to your controller routes.
|
|
|
|
*
|
|
|
|
* In addition, it is set as the URL generator's root namespace.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $namespace = 'App\Http\Controllers';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Define the routes for the application.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function map()
|
|
|
|
{
|
|
|
|
$this->mapWebRoutes();
|
|
|
|
$this->mapApiRoutes();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Define the "web" routes for the application.
|
|
|
|
*
|
|
|
|
* These routes all receive session state, CSRF protection, etc.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
protected function mapWebRoutes()
|
|
|
|
{
|
|
|
|
Route::group([
|
|
|
|
'middleware' => 'web',
|
2018-03-20 09:50:40 +08:00
|
|
|
'namespace' => $this->namespace,
|
2017-06-09 02:28:26 +08:00
|
|
|
], function ($router) {
|
2019-07-18 22:51:05 +08:00
|
|
|
require app_path('Http/Routes/web.php');
|
2017-06-09 02:28:26 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Define the "api" routes for the application.
|
|
|
|
*
|
|
|
|
* These routes are typically stateless.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
protected function mapApiRoutes()
|
|
|
|
{
|
|
|
|
Route::group([
|
2017-12-28 06:47:22 +08:00
|
|
|
'middleware' => ['api'],
|
2018-08-27 00:40:04 +08:00
|
|
|
'namespace' => $this->namespace.'\\Api',
|
2018-03-20 09:50:40 +08:00
|
|
|
'prefix' => 'api',
|
|
|
|
'as' => 'api.',
|
2017-06-09 02:28:26 +08:00
|
|
|
], function ($router) {
|
2019-07-18 22:51:05 +08:00
|
|
|
require app_path('Http/Routes/api.php');
|
2017-06-09 02:28:26 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|