- Laravel 13.9 + PHP 8.5 + MySQL - Bootstrap 5.3 + jQuery 3.7 + Chart.js (replacing Alpine/Tailwind) - Packages: intervention/image, dompdf, simple-qrcode, league/csv, laravel/breeze, laravel/boost - 17 database migrations: users, programs, qr_codes, participants, attendances, certificates, questionnaires, email_logs, audit_logs - 13 Eloquent models with full relationships - Admin layout (Bootstrap 5 sidebar) + public layout (mobile-first) - Rate limiters: checkin (60/min), certificate (30/min) - Admin seeder: admin@mbip.gov.my - Storage directories + symlink configured Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
37 lines
1.4 KiB
PHP
37 lines
1.4 KiB
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('attendances', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('program_id')->constrained('programs')->cascadeOnDelete();
|
|
$table->foreignId('participant_id')->constrained('participants')->cascadeOnDelete();
|
|
$table->foreignId('program_participant_id')->nullable()->constrained('program_participants')->nullOnDelete();
|
|
$table->enum('attendance_source', ['pre_registered_staff', 'walk_in_external', 'admin_manual']);
|
|
$table->enum('attendance_session', ['pagi', 'petang', 'full_day']);
|
|
$table->timestamp('checked_in_at');
|
|
$table->string('checked_in_ip', 45)->nullable();
|
|
$table->string('user_agent', 500)->nullable();
|
|
$table->string('notes', 500)->nullable();
|
|
$table->timestamps();
|
|
|
|
$table->unique(['program_id', 'participant_id']);
|
|
$table->index('program_id');
|
|
$table->index('participant_id');
|
|
$table->index('attendance_source');
|
|
$table->index('attendance_session');
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('attendances');
|
|
}
|
|
};
|