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
+57
View File
@@ -0,0 +1,57 @@
<?php
namespace App\Models;
use App\Models\BaseModel;
class SchoolClass extends BaseModel
{
protected $table = 'classes';
// CI: useTimestamps = false
public $timestamps = false;
protected $fillable = [
'class_name',
'schedule',
'capacity',
'semester',
'school_year',
];
protected $casts = [
'capacity' => 'integer',
];
/* =========================
* CI method equivalents
* ========================= */
public static function getAllClasses()
{
return static::query()->get();
}
public static function getClassById(int $id): ?self
{
return static::query()->find($id);
}
public static function createClass(array $data): int
{
$row = static::create($data);
return (int) $row->id;
}
public static function updateClass(int $id, array $data): bool
{
return static::query()->whereKey($id)->update($data) >= 0;
}
public static function deleteClass(int $id): bool
{
$row = static::query()->find($id);
if (!$row) return false;
return (bool) $row->delete();
}
}