add more Tickets Status enums
This commit is contained in:
parent
8b5e28bb92
commit
6ed570709b
2 changed files with 71 additions and 6 deletions
|
|
@ -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é'),
|
||||
|
|
|
|||
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\TicketStatus;
|
||||
use App\Models\Ticket;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdateTicketsStatusWithEnumStatus3 extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
foreach (Ticket::where('status', 2)->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()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue