public static function selectOptions($projectId = null)
{
$options = [];
$roles = static::select('id', 'name')->orderBy('name', 'ASC');
if ($projectId) {
$roles->where($roles->expr()->in('project_id', [0, $projectId]));
}
foreach ($roles->execute()->fetchAll() as $role) {
$options[] = ['label' => $role['name'], 'value' => $role['id']];
}
return $options;
}