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.

CreateCompanyDefaults.php 709B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace App\Listeners;
  3. use App\Events\CompanyGenerated;
  4. use App\Services\CompanyDefaultService;
  5. class CreateCompanyDefaults
  6. {
  7. /**
  8. * Create the event listener.
  9. */
  10. public function __construct()
  11. {
  12. //
  13. }
  14. /**
  15. * Handle the event.
  16. */
  17. public function handle(CompanyGenerated $event): void
  18. {
  19. $company = $event->company;
  20. $country = $event->country;
  21. $currencyCode = $country ? country($country)->getCurrency()['iso_4217_code'] : 'USD';
  22. $user = $company->owner;
  23. $companyDefaultService = new CompanyDefaultService();
  24. $companyDefaultService->createCompanyDefaults($company, $user, $currencyCode);
  25. }
  26. }