source: app/Providers/RouteServiceProvider.php@ dfae77e

Last change on this file since dfae77e was dfae77e, checked in by Igor Danilovski <igor_danilovski@…>, 21 months ago
  • Initial commit;
  • Property mode set to 100644
File size: 1.9 KB
Line 
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\Pagination\Paginator;
9use Illuminate\Support\Facades\RateLimiter;
10use Illuminate\Support\Facades\Route;
11
12class RouteServiceProvider extends ServiceProvider
13{
14 /**
15 * The path to the "home" route for your application.
16 *
17 * This is used by Laravel authentication to redirect users after login.
18 *
19 * @var string
20 */
21 public const HOME = '/explore';
22 public const ARTIST_HOME = '/offers';
23 public const ORGANIZER_HOME = '/explore';
24 public const MANAGER_HOME = '/artists';
25 public const ONBOARDING = '/onboarding';
26
27 /**
28 * The controller namespace for the application.
29 *
30 * When present, controller route declarations will automatically be prefixed with this namespace.
31 *
32 * @var string|null
33 */
34 // protected $namespace = 'App\\Http\\Controllers';
35
36 /**
37 * Define your route model bindings, pattern filters, etc.
38 *
39 * @return void
40 */
41 public function boot()
42 {
43 $this->configureRateLimiting();
44 Paginator::useBootstrap();
45 $this->routes(function () {
46 Route::prefix('api')
47 ->middleware('api')
48 ->namespace($this->namespace)
49 ->group(base_path('routes/api.php'));
50
51 Route::middleware('web')
52 ->namespace($this->namespace)
53 ->group(base_path('routes/web.php'));
54 });
55 }
56
57 /**
58 * Configure the rate limiters for the application.
59 *
60 * @return void
61 */
62 protected function configureRateLimiting()
63 {
64 RateLimiter::for('api', function (Request $request) {
65 return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
66 });
67 }
68}
Note: See TracBrowser for help on using the repository browser.