From 6ed570709b2852a42ed5a9c0378481eadbcc1fb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Fri, 21 May 2021 14:31:36 +0200 Subject: [PATCH] add more Tickets Status enums --- app/Enums/TicketStatus.php | 24 ++++++--- ...pdate_tickets_status_with_enum_status3.php | 53 +++++++++++++++++++ 2 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 database/migrations/2021_04_21_132140_update_tickets_status_with_enum_status3.php diff --git a/app/Enums/TicketStatus.php b/app/Enums/TicketStatus.php index 534da07..b0fe989 100644 --- a/app/Enums/TicketStatus.php +++ b/app/Enums/TicketStatus.php @@ -6,6 +6,10 @@ use Kwaadpepper\Enum\BaseEnum; /** * @method static self new() + * @method static self estimateTodo() + * @method static self estimateValidated() + * @method static self toPlan() + * @method static self planned() * @method static self inprogress() * @method static self waiting() * @method static self processed() @@ -19,12 +23,16 @@ class TicketStatus extends BaseEnum { return [ 'new' => 1, - 'inprogress' => 2, - 'waiting' => 3, - 'processed' => 4, - 'recette' => 5, - 'production' => 6, - 'archived' => 9, + 'estimateTodo' => 2, + 'estimateValidated' => 3, + 'toPlan' => 4, + 'planned' => 5, + 'inprogress' => 7, + 'waiting' => 9, + 'processed' => 10, + 'recette' => 12, + 'production' => 13, + 'archived' => 15, ]; } @@ -32,6 +40,10 @@ class TicketStatus extends BaseEnum { return [ 'new' => trans('Nouveau'), + 'estimateTodo' => trans('Devis à faire'), + 'estimateValidated' => trans('Devis validé'), + 'toPlan' => trans('À planifier'), + 'planned' => trans('Planifié'), 'inprogress' => trans('En cours'), 'waiting' => trans('En attente'), 'processed' => trans('Traité'), diff --git a/database/migrations/2021_04_21_132140_update_tickets_status_with_enum_status3.php b/database/migrations/2021_04_21_132140_update_tickets_status_with_enum_status3.php new file mode 100644 index 0000000..c0e75b7 --- /dev/null +++ b/database/migrations/2021_04_21_132140_update_tickets_status_with_enum_status3.php @@ -0,0 +1,53 @@ +get() as $ticket) { + $ticket->status = TicketStatus::inprogress(); + $ticket->save(); + } + foreach (Ticket::where('status', 3)->get() as $ticket) { + $ticket->status = TicketStatus::waiting(); + $ticket->save(); + } + foreach (Ticket::where('status', 4)->get() as $ticket) { + $ticket->status = TicketStatus::processed(); + $ticket->save(); + } + foreach (Ticket::where('status', 5)->get() as $ticket) { + $ticket->status = TicketStatus::recette(); + $ticket->save(); + } + foreach (Ticket::where('status', 6)->get() as $ticket) { + $ticket->status = TicketStatus::production(); + $ticket->save(); + } + foreach (Ticket::where('status', 9)->get() as $ticket) { + $ticket->status = TicketStatus::archived(); + $ticket->save(); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +}