From 710f54c0156c5fa081bc6af1a68e7cb44723939b Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Mon, 24 Jan 2022 19:34:26 +0100 Subject: add example in laravel --- .../iBook/app/Providers/AppServiceProvider.php | 28 ++++++++++ .../iBook/app/Providers/AuthServiceProvider.php | 30 +++++++++++ .../app/Providers/BroadcastServiceProvider.php | 21 ++++++++ .../iBook/app/Providers/EventServiceProvider.php | 32 +++++++++++ .../iBook/app/Providers/RouteServiceProvider.php | 63 ++++++++++++++++++++++ 5 files changed, 174 insertions(+) create mode 100644 Year_3/TSDWL/LARAVEL/iBook/app/Providers/AppServiceProvider.php create mode 100644 Year_3/TSDWL/LARAVEL/iBook/app/Providers/AuthServiceProvider.php create mode 100644 Year_3/TSDWL/LARAVEL/iBook/app/Providers/BroadcastServiceProvider.php create mode 100644 Year_3/TSDWL/LARAVEL/iBook/app/Providers/EventServiceProvider.php create mode 100644 Year_3/TSDWL/LARAVEL/iBook/app/Providers/RouteServiceProvider.php (limited to 'Year_3/TSDWL/LARAVEL/iBook/app/Providers') diff --git a/Year_3/TSDWL/LARAVEL/iBook/app/Providers/AppServiceProvider.php b/Year_3/TSDWL/LARAVEL/iBook/app/Providers/AppServiceProvider.php new file mode 100644 index 0000000..ee8ca5b --- /dev/null +++ b/Year_3/TSDWL/LARAVEL/iBook/app/Providers/AppServiceProvider.php @@ -0,0 +1,28 @@ + + */ + protected $policies = [ + // 'App\Models\Model' => 'App\Policies\ModelPolicy', + ]; + + /** + * Register any authentication / authorization services. + * + * @return void + */ + public function boot() + { + $this->registerPolicies(); + + // + } +} diff --git a/Year_3/TSDWL/LARAVEL/iBook/app/Providers/BroadcastServiceProvider.php b/Year_3/TSDWL/LARAVEL/iBook/app/Providers/BroadcastServiceProvider.php new file mode 100644 index 0000000..395c518 --- /dev/null +++ b/Year_3/TSDWL/LARAVEL/iBook/app/Providers/BroadcastServiceProvider.php @@ -0,0 +1,21 @@ +> + */ + protected $listen = [ + Registered::class => [ + SendEmailVerificationNotification::class, + ], + ]; + + /** + * Register any events for your application. + * + * @return void + */ + public function boot() + { + // + } +} diff --git a/Year_3/TSDWL/LARAVEL/iBook/app/Providers/RouteServiceProvider.php b/Year_3/TSDWL/LARAVEL/iBook/app/Providers/RouteServiceProvider.php new file mode 100644 index 0000000..3bd3c81 --- /dev/null +++ b/Year_3/TSDWL/LARAVEL/iBook/app/Providers/RouteServiceProvider.php @@ -0,0 +1,63 @@ +configureRateLimiting(); + + $this->routes(function () { + Route::prefix('api') + ->middleware('api') + ->namespace($this->namespace) + ->group(base_path('routes/api.php')); + + Route::middleware('web') + ->namespace($this->namespace) + ->group(base_path('routes/web.php')); + }); + } + + /** + * Configure the rate limiters for the application. + * + * @return void + */ + protected function configureRateLimiting() + { + RateLimiter::for('api', function (Request $request) { + return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip()); + }); + } +} -- cgit v1.2.3-18-g5258