From fe252fa0ff9315328948357325292c7be1f5d814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Fri, 21 May 2021 14:34:45 +0200 Subject: [PATCH] If evolution force the ticket status on estimateTodo --- app/Models/Ticket.php | 6 ++++++ 1 file changed, 6 insertions(+) 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)) {