data), true) ?? []; $maxPictos = $sectionData['max_pictos'] ?? 5; $count = Picto::where('section_id', $section->id)->count(); if ($count >= $maxPictos) { return "Le nombre maximum de pictos ($maxPictos) est atteint pour cette section."; } return Picto::create($data); } /** * Update the given picto with the provided data. */ public function update(Picto $picto, array $data): Picto | string { $picto->update($data); return $picto; } }