]> BookStack Code Mirror - bookstack/blob - app/Providers/RouteServiceProvider.php
b60443a452895fc19a8c4a5dcffdfeb03f339b52
[bookstack] / app / Providers / RouteServiceProvider.php
1 <?php
2
3 namespace BookStack\Providers;
4
5 use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
6 use Illuminate\Support\Facades\Route;
7
8 class RouteServiceProvider extends ServiceProvider
9 {
10     /**
11      * This namespace is applied to the controller routes in your routes file.
12      *
13      * In addition, it is set as the URL generator's root namespace.
14      *
15      * @var string
16      */
17     protected $namespace = 'BookStack\Http\Controllers';
18
19     /**
20      * Define your route model bindings, pattern filters, etc.
21      *
22      * @return void
23      */
24     public function boot()
25     {
26         parent::boot();
27     }
28
29     /**
30      * Define the routes for the application.
31      *
32      * @return void
33      */
34     public function map()
35     {
36         $this->mapWebRoutes();
37         $this->mapApiRoutes();
38     }
39
40     /**
41      * Define the "web" routes for the application.
42      *
43      * These routes all receive session state, CSRF protection, etc.
44      *
45      * @return void
46      */
47     protected function mapWebRoutes()
48     {
49         Route::group([
50             'middleware' => 'web',
51             'namespace'  => $this->namespace,
52         ], function ($router) {
53             require base_path('routes/web.php');
54         });
55     }
56
57     /**
58      * Define the "api" routes for the application.
59      *
60      * These routes are typically stateless.
61      *
62      * @return void
63      */
64     protected function mapApiRoutes()
65     {
66         Route::group([
67             'middleware' => 'api',
68             'namespace'  => $this->namespace . '\Api',
69             'prefix'     => 'api',
70         ], function ($router) {
71             require base_path('routes/api.php');
72         });
73     }
74 }