fix gitlab tests

This commit is contained in:
root
2026-06-09 02:32:58 -04:00
parent 20a0b6c4e5
commit 6def9993da
1489 changed files with 10449 additions and 11356 deletions
+33 -42
View File
@@ -3,6 +3,7 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use App\Models\BaseModel;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
@@ -11,7 +12,6 @@ use Illuminate\Support\Facades\DB;
class Student extends BaseModel
{
use HasFactory;
protected $table = 'students';
/**
@@ -31,6 +31,7 @@ class Student extends BaseModel
'is_new',
'parent_id',
'school_year',
'semester',
'registration_date',
'tuition_paid',
'year_of_registration',
@@ -39,15 +40,15 @@ class Student extends BaseModel
];
protected $casts = [
'school_id' => 'string',
'age' => 'integer',
'photo_consent' => 'boolean',
'is_new' => 'boolean',
'parent_id' => 'integer',
'tuition_paid' => 'boolean',
'is_active' => 'boolean',
'dob' => 'date',
'registration_date' => 'date',
'school_id' => 'string',
'age' => 'integer',
'photo_consent' => 'boolean',
'is_new' => 'boolean',
'parent_id' => 'integer',
'tuition_paid' => 'boolean',
'is_active' => 'boolean',
'dob' => 'date',
'registration_date' => 'date',
'year_of_registration' => 'integer',
];
@@ -97,7 +98,6 @@ class Student extends BaseModel
if ($schoolYear === null || strtolower(trim($schoolYear)) === 'all' || trim($schoolYear) === '') {
return $q;
}
return $q->where('school_year', $schoolYear);
}
@@ -214,7 +214,6 @@ class Student extends BaseModel
public static function getStudentSchoolIdByStudentId(int $studentId): ?string
{
$v = static::query()->where('id', $studentId)->value('school_id');
return $v !== null ? (string) $v : null;
}
@@ -234,16 +233,12 @@ class Student extends BaseModel
public static function getFullNameById($studentId): ?array
{
$student = static::query()->find($studentId);
if (! $student) {
return null;
}
if (!$student) return null;
$first = (string) ($student->firstname ?? '');
$last = (string) ($student->lastname ?? '');
$last = (string) ($student->lastname ?? '');
if ($first === '' && $last === '') {
return null;
}
if ($first === '' && $last === '') return null;
return ['firstname' => $first, 'lastname' => $last];
}
@@ -251,7 +246,7 @@ class Student extends BaseModel
/** legacy: getFullName($student array) */
public static function getFullName(array $student): string
{
return trim(($student['firstname'] ?? '').' '.($student['lastname'] ?? ''));
return trim(($student['firstname'] ?? '') . ' ' . ($student['lastname'] ?? ''));
}
/** legacy: getLastRegistrationDate($ParentId) */
@@ -278,9 +273,7 @@ class Student extends BaseModel
->pluck('student_id')
->all();
if (empty($studentIds)) {
return [];
}
if (empty($studentIds)) return [];
return static::query()
->whereIn('id', $studentIds)
@@ -348,9 +341,7 @@ class Student extends BaseModel
*/
public static function getStudentInfoByClassSectionId(int $classSectionId, ?string $semester = null, ?string $schoolYear = null, ?int $actorId = null): array
{
if ($classSectionId <= 0) {
return [];
}
if ($classSectionId <= 0) return [];
$q = DB::table('students')
->selectRaw('students.id AS student_id, students.school_id, students.firstname, students.lastname, sc.class_section_id')
@@ -385,22 +376,22 @@ class Student extends BaseModel
$req = $updating ? 'sometimes' : 'required';
return [
'school_id' => ['nullable', 'integer', 'min:1'],
'firstname' => [$req, 'string', 'max:120'],
'lastname' => [$req, 'string', 'max:120'],
'dob' => ['nullable', 'date'],
'age' => ['nullable', 'integer', 'min:0'],
'gender' => ['nullable', 'string', 'max:20'],
'registration_grade' => ['nullable', 'string', 'max:50'],
'photo_consent' => ['nullable', 'boolean'],
'is_new' => ['nullable', 'boolean'],
'parent_id' => ['nullable', 'integer'],
'school_year' => ['nullable', 'string', 'max:20'],
'registration_date' => ['nullable', 'date'],
'tuition_paid' => ['nullable', 'boolean'],
'year_of_registration' => ['nullable', 'integer', 'min:0'],
'rfid_tag' => ['nullable', 'string', 'max:120'],
'is_active' => ['nullable', 'boolean'],
'school_id' => ['nullable', 'integer', 'min:1'],
'firstname' => [$req, 'string', 'max:120'],
'lastname' => [$req, 'string', 'max:120'],
'dob' => ['nullable', 'date'],
'age' => ['nullable', 'integer', 'min:0'],
'gender' => ['nullable', 'string', 'max:20'],
'registration_grade' => ['nullable', 'string', 'max:50'],
'photo_consent' => ['nullable', 'boolean'],
'is_new' => ['nullable', 'boolean'],
'parent_id' => ['nullable', 'integer'],
'school_year' => ['nullable', 'string', 'max:20'],
'registration_date' => ['nullable', 'date'],
'tuition_paid' => ['nullable', 'boolean'],
'year_of_registration'=> ['nullable', 'integer', 'min:0'],
'rfid_tag' => ['nullable', 'string', 'max:120'],
'is_active' => ['nullable', 'boolean'],
];
}
}