Created
May 13, 2022 17:24
-
-
Save dgafka/382aab3d5165f9528a2bef4354ae8c3d to your computer and use it in GitHub Desktop.
asynchronous-messaging-10.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 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