add projet

This commit is contained in:
root
2026-03-05 12:29:37 -05:00
parent 8d1eef8ba8
commit 23b7db1107
9109 changed files with 1106501 additions and 73 deletions
+50
View File
@@ -0,0 +1,50 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class AttendanceEmailTemplate extends Model
{
protected $table = 'email_templates';
protected $fillable = [
'code',
'variant',
'subject',
'body_html',
'is_active',
'updated_by',
'updated_at',
];
public $timestamps = false;
protected $casts = [
'is_active' => 'boolean',
'updated_by' => 'integer',
'updated_at' => 'datetime',
];
/**
* Fetch an active template by code and variant, falling back to default.
*/
public function getTemplate(string $code, string $variant = 'default'): ?array
{
$row = self::query()
->where('code', $code)
->where('variant', $variant)
->where('is_active', true)
->first();
if ($row) {
return $row->toArray();
}
$row = self::query()
->where('code', $code)
->where('variant', 'default')
->where('is_active', true)
->first();
return $row ? $row->toArray() : null;
}
}