main
Last change
on this file since 092fcda was c454c0f, checked in by bube-ristovska <ristovska725@…>, 11 months ago |
First commit
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[c454c0f] | 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 your application's "home" route.
|
---|
| 15 | *
|
---|
| 16 | * Typically, users are redirected here after authentication.
|
---|
| 17 | *
|
---|
| 18 | * @var string
|
---|
| 19 | */
|
---|
| 20 | public const HOME = '/home';
|
---|
| 21 |
|
---|
| 22 | /**
|
---|
| 23 | * Define your route model bindings, pattern filters, and other route configuration.
|
---|
| 24 | */
|
---|
| 25 | public function boot(): void
|
---|
| 26 | {
|
---|
| 27 | RateLimiter::for('api', function (Request $request) {
|
---|
| 28 | return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
|
---|
| 29 | });
|
---|
| 30 |
|
---|
| 31 | $this->routes(function () {
|
---|
| 32 | Route::middleware('api')
|
---|
| 33 | ->prefix('api')
|
---|
| 34 | ->group(base_path('routes/api.php'));
|
---|
| 35 |
|
---|
| 36 | Route::middleware('web')
|
---|
| 37 | ->group(base_path('routes/web.php'));
|
---|
| 38 | });
|
---|
| 39 | }
|
---|
| 40 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.