type)) { $user->type = 'company'; $user->save(); return true; } return false; } catch (\Exception $e) { \Log::error('Failed to assign default role: ' . $e->getMessage()); return false; } } /** * Assign company role and permissions to user * * @param User $user * @return bool */ public static function assignCompanyPermissions(User $user): bool { try { // Get company role $companyRole = Role::where('name', 'company')->first(); if ($companyRole) { $user->assignRole($companyRole); $user->type = 'company'; $user->save(); return true; } return false; } catch (\Exception $e) { \Log::error('Failed to assign company role: ' . $e->getMessage()); return false; } } }