fix roles access issue
Deploy to Shared Hosting / Shared hosting deploy (push) Failing after 51s
Tests / PHPUnit (push) Successful in 1m38s

This commit is contained in:
root
2026-09-06 17:11:03 -04:00
parent 9e2f858343
commit 2ad7dc1170
3 changed files with 438 additions and 2 deletions
+10 -2
View File
@@ -63,8 +63,16 @@ class RoleModel extends Model
$names = array_values(array_filter(array_map('strval', $names)));
if (empty($names)) return [];
// collation is usually case-insensitive; if not, add LOWER() both sides
$ids = $this->select('id')->whereIn('name', $names)->findColumn('id');
$lower = array_values(array_unique(array_map('strtolower', $names)));
$builder = $this->select('id')
->groupStart()
->whereIn('LOWER(name)', $lower);
if ($this->db->fieldExists('slug', $this->table)) {
$builder->orWhereIn('LOWER(slug)', $lower);
}
$ids = $builder->groupEnd()->findColumn('id');
return array_map('intval', $ids ?? []);
}
}