phpvms/app/Providers/RouteServiceProvider.php

66 lines
1.5 KiB
PHP
Raw Normal View History

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',
'namespace' => $this->namespace,
2017-06-09 02:28:26 +08:00
], function ($router) {
require app_path('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([
'middleware' => ['api'],
2018-08-27 00:40:04 +08:00
'namespace' => $this->namespace.'\\Api',
'prefix' => 'api',
'as' => 'api.',
2017-06-09 02:28:26 +08:00
], function ($router) {
require app_path('Routes/api.php');
2017-06-09 02:28:26 +08:00
});
}
}