Files
alrahma_sunday_school_api/app/Models/AttendanceCommentTemplate.php
T
2026-06-08 23:45:55 -04:00

46 lines
968 B
PHP

<?php
namespace App\Models;
use App\Models\BaseModel;
class AttendanceCommentTemplate extends BaseModel
{
protected $table = 'attendance_comment_template';
// legacy: useTimestamps = false
public $timestamps = false;
protected $fillable = [
'min_score',
'max_score',
'template_text',
'is_active',
'created_at',
'updated_at',
];
protected $casts = [
'min_score' => 'integer',
'max_score' => 'integer',
'is_active' => 'boolean',
];
/**
* Equivalent of legacy getActiveTemplates():
* is_active=1, order by min_score DESC
*/
public static function getActiveTemplates()
{
return static::query()
->where('is_active', 1)
->orderByDesc('min_score')
->get();
}
// Optional: nice query scope version
public function scopeActive($q)
{
return $q->where('is_active', 1);
}
}