source: app/Providers/RouteServiceProvider.php@ 6b10b67

main
Last change on this file since 6b10b67 was c454c0f, checked in by bube-ristovska <ristovska725@…>, 11 months ago

First commit

  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[c454c0f]1<?php
2
3namespace App\Providers;
4
5use Illuminate\Cache\RateLimiting\Limit;
6use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
7use Illuminate\Http\Request;
8use Illuminate\Support\Facades\RateLimiter;
9use Illuminate\Support\Facades\Route;
10
11class 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.