fix roles access issue
This commit is contained in:
@@ -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 ?? []);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user