feat: Introduce InvoiceStep enum and add reminder_step column to invoice table.

This commit is contained in:
pbao9
2026-03-02 14:44:07 +07:00
parent 0c260a7e1c
commit db3a8c4949
3 changed files with 53 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace App\Enums\Invoice;
enum InvoiceStep: int
{
case STEP_1 = 1;
case STEP_2 = 2;
case STEP_3 = 3;
case STEP_4 = 4;
case STEP_5 = 5;
public function label(): string
{
return match ($this) {
self::STEP_1 => '1 ngày trước khi hết hạn',
self::STEP_2 => '3 ngày trước khi hết hạn',
self::STEP_3 => '7 ngày trước khi hết hạn',
self::STEP_4 => '14 ngày trước khi hết hạn',
self::STEP_5 => '30 ngày trước khi hết hạn',
};
}
}
@@ -28,6 +28,7 @@ return new class extends Migration {
$table->string('vm_id')->nullable()->index();
$table->unsignedInteger('rebuild_count')->nullable()->default(0);
$table->tinyInteger('invoice_type')->default(1);
$table->integer('reminder_step')->default(3);
$table->tinyInteger('status')->default(0);
$table->timestamps();
@@ -0,0 +1,29 @@
<?php
use App\Enums\Invoice\InvoiceStep;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('invoice', function (Blueprint $table) {
//
$table->enum('reminder_step', [InvoiceStep::STEP_1->value, InvoiceStep::STEP_2->value, InvoiceStep::STEP_3->value, InvoiceStep::STEP_4->value, InvoiceStep::STEP_5->value])->default(InvoiceStep::STEP_1->value)->after('auto_renew');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('invoice', function (Blueprint $table) {
//
});
}
};