Skip to content

Instantly share code, notes, and snippets.

@dgafka
Created September 24, 2022 09:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dgafka/c98a02ae5f16013abe93ba02ae3e3378 to your computer and use it in GitHub Desktop.
Save dgafka/c98a02ae5f16013abe93ba02ae3e3378 to your computer and use it in GitHub Desktop.
Working with asynchronous errors in PHP
<?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