Level 104
You could dispatch the job only the ID of the User instance; now you will not type-hint the User in the Job constructor, instead:
public function __construct(int $userId)
{
$this->user = User::withTrashed()->find($userId);
}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I dispatch a model with delay 1 hour, In the middle (after 30minutes) i soft delete the model before it get handle by queue system hence i will got ""No query results for model", My question is, How can i tell laravel to retrive models even though they got soft deleted in job class?
You could dispatch the job only the ID of the User instance; now you will not type-hint the User in the Job constructor, instead:
public function __construct(int $userId)
{
$this->user = User::withTrashed()->find($userId);
}
Please or to participate in this conversation.