reconstruction of the project

This commit is contained in:
root
2026-03-08 16:33:24 -04:00
parent 23b7db1107
commit c8de5f7edc
9157 changed files with 77877 additions and 1073823 deletions
+25 -6
View File
@@ -7,8 +7,10 @@ use App\Models\BaseModel;
class AttendanceCommentTemplate extends BaseModel
{
protected $table = 'attendance_comment_template';
protected $primaryKey = 'id';
// CI: useTimestamps = false
public $timestamps = true;
protected $fillable = [
'min_score',
'max_score',
@@ -18,10 +20,27 @@ class AttendanceCommentTemplate extends BaseModel
'updated_at',
];
public function getActiveTemplates(): array
protected $casts = [
'min_score' => 'integer',
'max_score' => 'integer',
'is_active' => 'boolean',
];
/**
* Equivalent of CI getActiveTemplates():
* is_active=1, order by min_score DESC
*/
public static function getActiveTemplates()
{
return $this->where('is_active', 1)
->orderBy('min_score', 'DESC')
->findAll();
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);
}
}