public function updated(StartRonde $startRonde): void{ // Check if scans are empty if (empty($startRonde->scans)) { return; } // Count the number of references in scans $scanCount = count($startRonde->scans); // Fetch the associated ronde and its pointeaux $ronde = $startRonde->ronde; // Assuming you have a relationship defined $pointeauCount = $ronde->pointeaux()->count(); // Count the pointeaux // Check if the counts are not equal if ($scanCount !== $pointeauCount) { Log::warning('Reference count does not match the number of Pointeaux for StartRonde ID: ' . $startRonde->id); return; } // Logic when counts are equal $startRonde->status = 'finished'; $startRonde->save(); // Save the changes to the database}