diff options
Diffstat (limited to 'app/Providers')
-rw-r--r-- | app/Providers/AppServiceProvider.php | 24 | ||||
-rw-r--r-- | app/Providers/AuthServiceProvider.php | 26 | ||||
-rw-r--r-- | app/Providers/BroadcastServiceProvider.php | 19 | ||||
-rw-r--r-- | app/Providers/EventServiceProvider.php | 38 | ||||
-rw-r--r-- | app/Providers/RouteServiceProvider.php | 40 |
5 files changed, 147 insertions, 0 deletions
diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php new file mode 100644 index 0000000..452e6b6 --- /dev/null +++ b/app/Providers/AppServiceProvider.php @@ -0,0 +1,24 @@ +<?php + +namespace App\Providers; + +use Illuminate\Support\ServiceProvider; + +class AppServiceProvider extends ServiceProvider +{ + /** + * Register any application services. + */ + public function register(): void + { + // + } + + /** + * Bootstrap any application services. + */ + public function boot(): void + { + // + } +} diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php new file mode 100644 index 0000000..54756cd --- /dev/null +++ b/app/Providers/AuthServiceProvider.php @@ -0,0 +1,26 @@ +<?php + +namespace App\Providers; + +// use Illuminate\Support\Facades\Gate; +use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; + +class AuthServiceProvider extends ServiceProvider +{ + /** + * The model to policy mappings for the application. + * + * @var array<class-string, class-string> + */ + protected $policies = [ + // + ]; + + /** + * Register any authentication / authorization services. + */ + public function boot(): void + { + // + } +} diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php new file mode 100644 index 0000000..2be04f5 --- /dev/null +++ b/app/Providers/BroadcastServiceProvider.php @@ -0,0 +1,19 @@ +<?php + +namespace App\Providers; + +use Illuminate\Support\Facades\Broadcast; +use Illuminate\Support\ServiceProvider; + +class BroadcastServiceProvider extends ServiceProvider +{ + /** + * Bootstrap any application services. + */ + public function boot(): void + { + Broadcast::routes(); + + require base_path('routes/channels.php'); + } +} diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php new file mode 100644 index 0000000..2d65aac --- /dev/null +++ b/app/Providers/EventServiceProvider.php @@ -0,0 +1,38 @@ +<?php + +namespace App\Providers; + +use Illuminate\Auth\Events\Registered; +use Illuminate\Auth\Listeners\SendEmailVerificationNotification; +use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; +use Illuminate\Support\Facades\Event; + +class EventServiceProvider extends ServiceProvider +{ + /** + * The event to listener mappings for the application. + * + * @var array<class-string, array<int, class-string>> + */ + protected $listen = [ + Registered::class => [ + SendEmailVerificationNotification::class, + ], + ]; + + /** + * Register any events for your application. + */ + public function boot(): void + { + // + } + + /** + * Determine if events and listeners should be automatically discovered. + */ + public function shouldDiscoverEvents(): bool + { + return false; + } +} diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php new file mode 100644 index 0000000..1cf5f15 --- /dev/null +++ b/app/Providers/RouteServiceProvider.php @@ -0,0 +1,40 @@ +<?php + +namespace App\Providers; + +use Illuminate\Cache\RateLimiting\Limit; +use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; +use Illuminate\Http\Request; +use Illuminate\Support\Facades\RateLimiter; +use Illuminate\Support\Facades\Route; + +class RouteServiceProvider extends ServiceProvider +{ + /** + * The path to your application's "home" route. + * + * Typically, users are redirected here after authentication. + * + * @var string + */ + public const HOME = '/home'; + + /** + * Define your route model bindings, pattern filters, and other route configuration. + */ + public function boot(): void + { + RateLimiter::for('api', function (Request $request) { + return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); + }); + + $this->routes(function () { + Route::middleware('api') + ->prefix('api') + ->group(base_path('routes/api.php')); + + Route::middleware('web') + ->group(base_path('routes/web.php')); + }); + } +} |