Created
September 24, 2022 09:11
-
-
Save dgafka/c98a02ae5f16013abe93ba02ae3e3378 to your computer and use it in GitHub Desktop.
Working with asynchronous errors in PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class OrderPlacedEmailSender implements ShouldQueue | |
{ | |
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; | |
public SendPlaceOrderEmail $email; | |
public function __construct(SendPlaceOrderEmail $email) | |
{ | |
$this->email = $email; | |
} | |
public function handle() | |
{ | |
// send an SMS message! | |
} | |
} | |
class Payment implements ShouldQueue | |
{ | |
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; | |
public MakePayment $makePayment; | |
public function __construct(MakePayment $makePayment) | |
{ | |
$this->makePayment = $makePayment; | |
} | |
public function handle() | |
{ | |
// take a payment from credit card | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment