diff --git a/app/Models/Ticket.php b/app/Models/Ticket.php index 45c8282..e68fa87 100644 --- a/app/Models/Ticket.php +++ b/app/Models/Ticket.php @@ -30,6 +30,12 @@ class Ticket extends Model protected static function booted() { + static::creating(function (Ticket $ticket) { + // If evolution force the ticket status on estimateTodo + if ($ticket->type->equals(TicketType::evolution())) { + $ticket->status = TicketStatus::estimateTodo(); + } + }); static::updating(function (Ticket $ticket) { $oldStatus = Ticket::where('id', $ticket->id)->first()->status; if (!$ticket->status->equals($oldStatus)) {