diff --git a/src/Jobs/CreateBeamClaims.php b/src/Jobs/CreateBeamClaims.php index 9645da9..e4cf4ab 100644 --- a/src/Jobs/CreateBeamClaims.php +++ b/src/Jobs/CreateBeamClaims.php @@ -37,11 +37,11 @@ public function handle(): void $this->chunk ->pluck('beam_id', 'beam_id') - ->each( - fn ($beamId) => event( - new CreateBeamClaimsCompleted(Beam::select('id', 'code')->find($beamId)->toArray()) - ) - ); + ->each(function ($beamId) { + if ($beam = Beam::select('id', 'code')->find($beamId)) { + event(new CreateBeamClaimsCompleted($beam->toArray())); + } + }); unset($this->chunk); }