hypothetical/app/Providers/RouteServiceProvider.php

74 lines
1.5 KiB
PHP
Raw Normal View History

<?php
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
2019-10-31 17:24:53 -04:00
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
/**
2016-08-19 16:38:49 -04:00
* 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 your route model bindings, pattern filters, etc.
*
* @return void
*/
2016-08-19 16:38:49 -04:00
public function boot()
{
//
2016-08-19 16:38:49 -04:00
parent::boot();
}
/**
* Define the routes for the application.
*
* @return void
*/
2016-08-19 16:38:49 -04:00
public function map()
{
2016-08-19 16:38:49 -04:00
$this->mapApiRoutes();
$this->mapWebRoutes();
2016-08-19 16:38:49 -04:00
//
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*
* @return void
*/
protected function mapWebRoutes()
{
2017-01-26 19:17:37 -05:00
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
2016-08-19 16:38:49 -04:00
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*
* @return void
*/
protected function mapApiRoutes()
{
2017-01-26 19:17:37 -05:00
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
}
}