Traq\Models\ProjectRole::selectOptions PHP Method

selectOptions() public static method

Returns an array formatted for the Form::select() method.
public static selectOptions ( $projectId = null ) : array
return array
    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;
    }
ProjectRole