| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
-
- namespace App\Providers;
-
- use App\Billing\StripeSubscriptionGateway;
- use App\Billing\SubscriptionGateway;
- use App\Commerce\Payments\PaymentGateway;
- use App\Commerce\Payments\StripeGateway;
- use Carbon\CarbonImmutable;
- use Illuminate\Support\Facades\Date;
- use Illuminate\Support\Facades\DB;
- use Illuminate\Support\ServiceProvider;
- use Illuminate\Validation\Rules\Password;
-
- class AppServiceProvider extends ServiceProvider
- {
- /**
- * Register any application services.
- */
- public function register(): void
- {
- // Payments go through one interface, so the provider can be changed in one place.
- $this->app->bind(PaymentGateway::class, StripeGateway::class);
- $this->app->bind(SubscriptionGateway::class, StripeSubscriptionGateway::class);
- }
-
- /**
- * Bootstrap any application services.
- */
- public function boot(): void
- {
- $this->configureDefaults();
- }
-
- /**
- * Configure default behaviors for production-ready applications.
- */
- protected function configureDefaults(): void
- {
- Date::use(CarbonImmutable::class);
-
- DB::prohibitDestructiveCommands(
- app()->isProduction(),
- );
-
- Password::defaults(fn (): ?Password => app()->isProduction()
- ? Password::min(12)
- ->mixedCase()
- ->letters()
- ->numbers()
- ->symbols()
- ->uncompromised()
- : null,
- );
- }
- }
|