Certificate manager built on Laravel 13, Livewire 4, and Flux. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
28 lines
801 B
PHP
28 lines
801 B
PHP
<?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('certificates', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
|
$table->foreignId('category_id')->nullable()->constrained()->nullOnDelete();
|
|
$table->string('title');
|
|
$table->string('file_path')->nullable();
|
|
$table->date('expires_at');
|
|
$table->timestamps();
|
|
|
|
$table->index(['user_id', 'expires_at']);
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('certificates');
|
|
}
|
|
};
|