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
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use App\Models\BaseModel;
class FamilyStudent extends BaseModel {
protected $table = 'family_students';
protected $primaryKey = 'id';
protected $fillable = [
'family_id',
'student_id',
'is_primary_home',
'notes',
'created_at',
'updated_at',
];
public $timestamps = true;
public function getFamiliesForStudent(int $studentId): array {
$db = \Config\Database::connect();
$sql = "SELECT f.* , fs.is_primary_home\n FROM family_students fs\n JOIN families f ON f.id = fs.family_id\n WHERE fs.student_id = ? AND f.is_active = 1\n ORDER BY fs.is_primary_home DESC, f.household_name";
return $db->query($sql, [$studentId])->getResultArray();
}
}