- 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>
41 lines
835 B
PHP
41 lines
835 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class CertificateTemplate extends Model
|
|
{
|
|
protected $fillable = [
|
|
'program_id', 'original_filename', 'image_path', 'config_json', 'is_active', 'uploaded_by',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'config_json' => 'array',
|
|
'is_active' => 'boolean',
|
|
];
|
|
}
|
|
|
|
public function program()
|
|
{
|
|
return $this->belongsTo(Program::class);
|
|
}
|
|
|
|
public function uploader()
|
|
{
|
|
return $this->belongsTo(User::class, 'uploaded_by');
|
|
}
|
|
|
|
public function certificates()
|
|
{
|
|
return $this->hasMany(Certificate::class);
|
|
}
|
|
|
|
public function getFieldConfig(string $field): ?array
|
|
{
|
|
return $this->config_json['fields'][$field] ?? null;
|
|
}
|
|
}
|