mirror of
https://github.com/archtechx/jobpipeline.git
synced 2025-12-12 18:24:05 +00:00
feat: allow custom method names
This commit is contained in:
parent
8b793e0cf2
commit
524f05e749
1 changed files with 2 additions and 2 deletions
|
|
@ -65,12 +65,12 @@ class JobPipeline implements ShouldQueue
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
foreach ($this->jobs as $job) {
|
foreach ($this->jobs as $job) {
|
||||||
if (is_string($job)) {
|
if (class_exists($job)) {
|
||||||
$job = [new $job(...$this->passable), 'handle'];
|
$job = [new $job(...$this->passable), 'handle'];
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$result = app()->call($job);
|
$result = app()->call($job, $this->passable);
|
||||||
} catch (Throwable $exception) {
|
} catch (Throwable $exception) {
|
||||||
if (method_exists(get_class($job[0]), 'failed')) {
|
if (method_exists(get_class($job[0]), 'failed')) {
|
||||||
call_user_func_array([$job[0], 'failed'], [$exception]);
|
call_user_func_array([$job[0], 'failed'], [$exception]);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue