AI store generator for ecommerce, Malaysia first. Laravel 13 + React + TypeScript.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

AppServiceProvider.php 1.7KB

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