Since: 3.0.0
Author: Jack P.
Inheritance: extends Traq\Models\Model
Beispiel #1
0
 /**
  * Insert priorities.
  */
 public function insertPriorities()
 {
     $priorities = ['Highest', 'High', 'Normal', 'Low', 'Lowest'];
     foreach ($priorities as $priority) {
         $model = new Priority(['name' => $priority]);
         $model->save();
     }
 }
Beispiel #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;
 }
Beispiel #3
0
 /**
  * Ticket priorities.
  */
 public function prioritiesAction()
 {
     return $this->jsonResponse(Priority::select()->execute()->fetchAll());
 }
Beispiel #4
0
function createPriority()
{
    $priority = new Priority(['name' => 'priority-' . mkRandomHash(5) . '-name']);
    $priority->save();
    return $priority;
}