bloodykheeng wrote a reply+100 XP
1mo ago
@swagger i think ur very right on this ive made notes about ur solution anyone from future can reference Laravel production cache file driver issue
bloodykheeng wrote a reply+100 XP
4mos ago
just use updateOrCreate
// // Create or retrieve the role
// $role = Role::firstOrCreate(['name' => $roleName]);
// Create or retrieve the role - FIXED: updateOrCreate to handle name changes
$role = Role::updateOrCreate(
['name' => $roleName], // Search by exact name
['name' => $roleName] // Update name if found
);