1 | <?php |
||
2 | |||
3 | namespace App\Providers; |
||
4 | |||
5 | use Illuminate\Cache\RateLimiting\Limit; |
||
6 | use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; |
||
7 | use Illuminate\Http\Request; |
||
8 | use Illuminate\Support\Facades\RateLimiter; |
||
9 | use Illuminate\Support\Facades\Route; |
||
10 | |||
11 | class RouteServiceProvider extends ServiceProvider |
||
12 | { |
||
13 | /** |
||
14 | * The path to the "home" route for your application. |
||
15 | * |
||
16 | * This is used by Laravel authentication to redirect users after login. |
||
17 | * |
||
18 | * @var string |
||
19 | */ |
||
20 | public const HOME = '/'; |
||
21 | |||
22 | /** |
||
23 | * The controller namespace for the application. |
||
24 | * |
||
25 | * When present, controller route declarations will automatically be prefixed with this namespace. |
||
26 | * |
||
27 | * @var string|null |
||
28 | */ |
||
29 | protected $namespace = 'App\\Http\\Controllers'; |
||
30 | |||
31 | /** |
||
32 | * Define your route model bindings, pattern filters, etc. |
||
33 | * |
||
34 | * @return void |
||
35 | */ |
||
36 | public function boot() |
||
37 | { |
||
38 | //$this->configureRateLimiting(); |
||
39 | |||
40 | $this->routes(function () { |
||
41 | |||
42 | /** |
||
43 | * Define the "api" routes for the application. |
||
44 | * |
||
45 | * These routes are typically stateless. |
||
46 | */ |
||
47 | Route::prefix('api') |
||
48 | ->middleware('api') |
||
49 | ->namespace($this->namespace) |
||
50 | ->group(base_path('routes/api.php')); |
||
51 | |||
52 | /** |
||
53 | * Define the "web" routes for the application. |
||
54 | * |
||
55 | * These routes all receive session state, CSRF protection, etc. |
||
56 | */ |
||
57 | Route::middleware('web') |
||
58 | ->namespace($this->namespace) |
||
59 | ->group(base_path('routes/web.php')); |
||
60 | }); |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * Configure the rate limiters for the application. |
||
65 | * |
||
66 | * @return void |
||
67 | */ |
||
68 | protected function configureRateLimiting() |
||
69 | { |
||
70 | RateLimiter::for('api', function (Request $request) { |
||
0 ignored issues
–
show
|
|||
71 | return Limit::perMinute(60); |
||
72 | }); |
||
73 | } |
||
74 | } |
||
75 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.