8000 Merge branch 'feature/async' into async-with-cn · sablesoft/laravel-json-api@e7679af · GitHub
[go: up one dir, main page]

Skip to content

Commit e7679af

Browse files
committed
Merge branch 'feature/async' into async-with-cn
2 parents 6f8c3c8 + c7fc5ff commit e7679af

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/Queue/ClientDispatchable.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,21 @@ public function resourceId(): ?string
6363
{
6464
return optional($this->clientJob)->resource_id;
6565
}
66+
67+
/**
68+
* Set the resource that the job relates to.
69+
*
70+
* If a job is creating a new resource, this method can be used to update
71+
* the client job with the created resource. This method does nothing if the
72+
* job was not dispatched by a client.
73+
*
74+
* @param $resource
75+
* @return void
76+
*/
77+
public function setResource($resource): void
78+
{
79+
if ($this->wasClientDispatched()) {
80+
$this->clientJob->setResource($resource)->save();
81+
}
82+
}
6683
}

0 commit comments

Comments
 (0)
0