AI store generator for ecommerce, Malaysia first. Laravel 13 + React + TypeScript.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AppServiceProvider.php 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace App\Providers;
  3. use App\Billing\StripeSubscriptionGateway;
  4. use App\Billing\SubscriptionGateway;
  5. use App\Commerce\Payments\PaymentGateway;
  6. use App\Commerce\Payments\StripeGateway;
  7. use App\Commerce\Shipping\FlatRateShipping;
  8. use App\Commerce\Shipping\ShippingProvider;
  9. use Carbon\CarbonImmutable;
  10. use Illuminate\Support\Facades\Date;
  11. use Illuminate\Support\Facades\DB;
  12. use Illuminate\Support\ServiceProvider;
  13. use Illuminate\Validation\Rules\Password;
  14. class AppServiceProvider extends ServiceProvider
  15. {
  16. /**
  17. * Register any application services.
  18. */
  19. public function register(): void
  20. {
  21. // Payments go through one interface, so the provider can be changed in one place.
  22. $this->app->bind(PaymentGateway::class, StripeGateway::class);
  23. $this->app->bind(SubscriptionGateway::class, StripeSubscriptionGateway::class);
  24. $this->app->bind(ShippingProvider::class, FlatRateShipping::class);
  25. }
  26. /**
  27. * Bootstrap any application services.
  28. */
  29. public function boot(): void
  30. {
  31. $this->configureDefaults();
  32. }
  33. /**
  34. * Configure default behaviors for production-ready applications.
  35. */
  36. protected function configureDefaults(): void
  37. {
  38. Date::use(CarbonImmutable::class);
  39. DB::prohibitDestructiveCommands(
  40. app()->isProduction(),
  41. );
  42. Password::defaults(fn (): ?Password => app()->isProduction()
  43. ? Password::min(12)
  44. ->mixedCase()
  45. ->letters()
  46. ->numbers()
  47. ->symbols()
  48. ->uncompromised()
  49. : null,
  50. );
  51. }
  52. }