Updating a text input after dispatching a job
The
dispatchOriginalityCheckJob
is updating the current article's originality_check_result
field to the correct value, but it's not being reflected live on the form itself. Can I somehow force this 'refresh'?6 Replies
Did you try injecting
Set $set
?
$set('originality_check_result', 'xx')
Yes. i tried it like this but it didn't help -
the
originality_check_result
is being updated in the background, so it reaches the $set
method before the job is finished..hum..
does it mean i need to think of some real-time solution with broadcasting and such?
if only i could return a value from the dispatched job itself and then put in inside the $set
i mean, i can always remove
Illuminate\Bus\Queueable
from the job and then be able to return data from my handle
method, but im not sure its an elegant solution..How complex is your
dispatchOriginalityCheckJob
? Does it warrant the extra complexity or could you do that simply (if its a simple operation) inline and immediately get the result back to set it properly? 🤔i compromised and gave up the asynchronicity simply using
->dispatchSync()
and setting the value right away. -
and dispatchOriginalityCheckJob()
is now -
thank you both @dissto and @Leandro Ferreira !!