Skip to content

Instantly share code, notes, and snippets.

@dgafka
Created May 13, 2022 17:24
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/382aab3d5165f9528a2bef4354ae8c3d to your computer and use it in GitHub Desktop.
Save dgafka/382aab3d5165f9528a2bef4354ae8c3d to your computer and use it in GitHub Desktop.
asynchronous-messaging-10.php
<?php
class AddExecutorIdMiddleware
{
/**
* @param mixed $job
* @param callable $next
* @return mixed
*/
public function handle($job, $next)
{
$job->addExecutorId($id);
// you may stop the job by not calling $next
$next($job);
}
}
class PlaceOrder implements ShouldQueue
{
(..)
public function middleware()
{
return [new AddExecutorIdMiddleware];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment