feat(ticket): implement ticket generation service, model, and exception handling with tests

This commit is contained in:
2026-07-21 11:20:52 -03:00
parent c3f54c79cb
commit a928a2e848
6 changed files with 526 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('tickets', function (Blueprint $table): void {
$table->id();
$table->string('tenant_code');
$table->uuid('ticket');
$table->string('name');
$table->text('description');
$table->dateTime('starts_at')->nullable();
$table->dateTime('expires_at')->nullable();
$table->dateTime('used_at')->nullable();
$table->foreignId('user_id')->constrained()->cascadeOnUpdate()->restrictOnDelete();
$table->foreign('tenant_code')
->references('codigo')
->on('tenants')
->cascadeOnUpdate()
->restrictOnDelete();
});
}
public function down(): void
{
Schema::dropIfExists('tickets');
}
};