С версии: 3.0.0
Автор: Jack P.
Наследование: extends Traq\Models\Model
Пример #1
0
 /**
  * Insert severities.
  */
 public function insertSeverities()
 {
     $severities = ['Blocker', 'Critical', 'Major', 'Normal', 'Minor', 'Trivial'];
     foreach ($severities as $severity) {
         $model = new Severity(['name' => $severity]);
         $model->save();
     }
 }
Пример #2
0
 /**
  * Returns options for the specific ticket filter.
  *
  * @param string $filter
  *
  * @return array
  */
 public static function selectOptionsFor($filter, Project $project)
 {
     switch ($filter) {
         // Milestone options
         case 'milestone':
             $options = $project->milestoneSelectOptions('slug');
             break;
             // Version options
         // Version options
         case 'version':
             $options = $project->milestoneSelectOptions('slug');
             break;
             // Type options
         // Type options
         case 'type':
             $options = Type::selectOptions('name');
             break;
             // Status options
         // Status options
         case 'status':
             $options = Status::selectOptions('name');
             break;
             // Component options
         // Component options
         case 'component':
             $options = Component::selectOptions($project->id, 'name');
             break;
             // Priority options
         // Priority options
         case 'priority':
             $options = Priority::selectOptions('name');
             break;
             // Severity options
         // Severity options
         case 'severity':
             $options = Severity::selectOptions('name');
             break;
     }
     return $options;
 }
Пример #3
0
function createSeverity()
{
    $severity = new Severity(['name' => 'severity-' . mkRandomHash(5) . '-name']);
    $severity->save();
    return $severity;
}