closure = serialize($wrapper); $job->params = serialize($params); $job->attempts = 0; $job->save(); return $job->id; } public function shift(): ?Job { $attempts = config('queue.database.attempts'); return Job::where('attempts', '<', $attempts) ->where('is_complete', false) ->first(); } }