1 |
5d28dbf4
|
Marek Lovčí
|
<?php
|
2 |
|
|
|
3 |
|
|
namespace App\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 your controller routes.
|
12 |
|
|
*
|
13 |
|
|
* In addition, it is set as the URL generator's root namespace.
|
14 |
|
|
*
|
15 |
|
|
* @var string
|
16 |
|
|
*/
|
17 |
|
|
protected $namespace = 'App\Http\Controllers';
|
18 |
|
|
|
19 |
|
|
/**
|
20 |
|
|
* The path to the "home" route for your application.
|
21 |
|
|
*
|
22 |
|
|
* @var string
|
23 |
|
|
*/
|
24 |
|
|
public const HOME = '/home';
|
25 |
|
|
|
26 |
|
|
/**
|
27 |
|
|
* Define your route model bindings, pattern filters, etc.
|
28 |
|
|
*
|
29 |
|
|
* @return void
|
30 |
|
|
*/
|
31 |
|
|
public function boot()
|
32 |
|
|
{
|
33 |
|
|
//
|
34 |
|
|
|
35 |
|
|
parent::boot();
|
36 |
|
|
}
|
37 |
|
|
|
38 |
|
|
/**
|
39 |
|
|
* Define the routes for the application.
|
40 |
|
|
*
|
41 |
|
|
* @return void
|
42 |
|
|
*/
|
43 |
|
|
public function map()
|
44 |
|
|
{
|
45 |
|
|
$this->mapApiRoutes();
|
46 |
|
|
|
47 |
|
|
$this->mapWebRoutes();
|
48 |
|
|
|
49 |
|
|
//
|
50 |
|
|
}
|
51 |
|
|
|
52 |
|
|
/**
|
53 |
|
|
* Define the "web" routes for the application.
|
54 |
|
|
*
|
55 |
|
|
* These routes all receive session state, CSRF protection, etc.
|
56 |
|
|
*
|
57 |
|
|
* @return void
|
58 |
|
|
*/
|
59 |
|
|
protected function mapWebRoutes()
|
60 |
|
|
{
|
61 |
|
|
Route::middleware('web')
|
62 |
|
|
->namespace($this->namespace)
|
63 |
|
|
->group(base_path('routes/web.php'));
|
64 |
|
|
}
|
65 |
|
|
|
66 |
|
|
/**
|
67 |
|
|
* Define the "api" routes for the application.
|
68 |
|
|
*
|
69 |
|
|
* These routes are typically stateless.
|
70 |
|
|
*
|
71 |
|
|
* @return void
|
72 |
|
|
*/
|
73 |
|
|
protected function mapApiRoutes()
|
74 |
|
|
{
|
75 |
|
|
Route::prefix('api')
|
76 |
|
|
->middleware('api')
|
77 |
|
|
->namespace($this->namespace)
|
78 |
|
|
->group(base_path('routes/api.php'));
|
79 |
|
|
}
|
80 |
|
|
}
|