Files
spa-api/app/Providers/RouteServiceProvider.php

80 lines
1.6 KiB
PHP
Raw Normal View History

<?php
namespace App\Providers;
2014-08-11 10:13:20 -05:00
2016-07-11 15:44:50 -05:00
use Illuminate\Support\Facades\Route;
2014-09-30 21:13:58 -05:00
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
2014-08-11 10:13:20 -05:00
2015-02-22 20:47:03 -06:00
class RouteServiceProvider extends ServiceProvider
{
/**
2016-03-23 17:04:42 -05:00
* This namespace is applied to your controller routes.
2015-02-22 20:47:03 -06:00
*
* In addition, it is set as the URL generator's root namespace.
*
* @var string
*/
protected $namespace = 'App\Http\Controllers';
2015-02-22 20:47:03 -06:00
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
2016-07-11 15:44:50 -05:00
public function boot()
2015-02-22 20:47:03 -06:00
{
//
2016-07-11 15:44:50 -05:00
parent::boot();
2015-02-22 20:47:03 -06:00
}
2014-08-11 10:13:20 -05:00
2015-02-22 20:47:03 -06:00
/**
* Define the routes for the application.
*
* @return void
*/
2016-07-11 15:44:50 -05:00
public function map()
2015-02-22 20:47:03 -06:00
{
2016-07-14 09:36:17 -05:00
$this->mapApiRoutes();
2016-09-05 20:54:21 +10:00
$this->mapWebRoutes();
2016-03-23 17:04:42 -05:00
//
}
/**
* Define the "web" routes for the application.
*
2016-03-23 17:05:17 -05:00
* These routes all receive session state, CSRF protection, etc.
*
2016-03-23 17:04:42 -05:00
* @return void
*/
2016-07-11 15:44:50 -05:00
protected function mapWebRoutes()
2016-03-23 17:04:42 -05:00
{
2016-07-11 15:44:50 -05:00
Route::group([
2016-07-30 23:36:24 +03:00
'middleware' => 'web',
'namespace' => $this->namespace,
2016-03-23 17:04:42 -05:00
], function ($router) {
2016-07-14 09:36:17 -05:00
require base_path('routes/web.php');
});
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*
* @return void
*/
protected function mapApiRoutes()
{
Route::group([
2016-08-21 01:17:41 +02:00
'middleware' => 'api',
2016-07-24 22:17:23 -05:00
'namespace' => $this->namespace,
'prefix' => 'api',
2016-07-14 09:36:17 -05:00
], function ($router) {
require base_path('routes/api.php');
2015-02-22 20:47:03 -06:00
});
}
}