Traq\Models\Timeline::newTicketEvent PHP Method

newTicketEvent() public static method

Creates a new Timeline object relating to a new ticket event.
public static newTicketEvent ( $user, $ticket ) : Timeline
return Timeline
    public static function newTicketEvent($user, $ticket)
    {
        return new static(['project_id' => $ticket['project_id'], 'owner_type' => 'Ticket', 'owner_id' => $ticket['id'], 'user_id' => $user['id'], 'action' => "ticket_created"]);
    }

Usage Example

Esempio n. 1
0
 /**
  * Create ticket.
  */
 public function createAction()
 {
     $ticket = new Ticket($this->ticketParams());
     if ($ticket->validate()) {
         $ticket->save();
         Timeline::newTicketEvent($this->currentUser, $ticket)->save();
         $this->currentProject->next_ticket_id++;
         $this->currentProject->save();
         return $this->redirectTo('ticket', ['pslug' => $this->currentProject['slug'], 'id' => $ticket->ticket_id]);
     }
     return $this->render('tickets/new.phtml', ['ticket' => $ticket]);
 }
All Usage Examples Of Traq\Models\Timeline::newTicketEvent