Fix Laravel Pint formatting

This commit is contained in:
root
2026-06-08 23:30:22 -04:00
parent 567dc24649
commit c792b8be05
1288 changed files with 10766 additions and 9669 deletions
+33 -24
View File
@@ -3,7 +3,6 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use App\Models\BaseModel;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Support\Facades\DB;
@@ -23,16 +22,17 @@ class StudentClass extends BaseModel
'updated_at',
'created_at',
];
public $timestamps = true;
protected $casts = [
'student_id' => 'integer',
'school_id' => 'integer',
'student_id' => 'integer',
'school_id' => 'integer',
'class_section_id' => 'integer',
'is_event_only' => 'boolean',
'updated_by' => 'integer',
'created_at' => 'datetime',
'updated_at' => 'datetime',
'is_event_only' => 'boolean',
'updated_by' => 'integer',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
/* ============================================================
@@ -84,7 +84,10 @@ class StudentClass extends BaseModel
public function scopeForYear(Builder $q, ?string $schoolYear): Builder
{
if ($schoolYear === null || trim($schoolYear) === '') return $q;
if ($schoolYear === null || trim($schoolYear) === '') {
return $q;
}
return $q->where('student_class.school_year', $schoolYear);
}
@@ -134,12 +137,12 @@ class StudentClass extends BaseModel
->where('sc.school_year', $schoolYear)
->orderBy('cs.class_section_name', 'asc')
->pluck('cs.class_section_name')
->filter(fn ($v) => $v !== null && trim((string)$v) !== '')
->filter(fn ($v) => $v !== null && trim((string) $v) !== '')
->unique()
->values()
->all();
return $asArray ? $names : (!empty($names) ? implode(', ', $names) : '');
return $asArray ? $names : (! empty($names) ? implode(', ', $names) : '');
}
/**
@@ -162,15 +165,17 @@ class StudentClass extends BaseModel
$names = [];
foreach ($rows as $r) {
$name = $r->class_section_name ?? null;
if (!$name) continue;
if (! $name) {
continue;
}
$isEvent = (int)($r->is_event_only ?? 0) === 1;
$names[] = $isEvent ? ($name . ' (Event)') : $name;
$isEvent = (int) ($r->is_event_only ?? 0) === 1;
$names[] = $isEvent ? ($name.' (Event)') : $name;
}
$names = array_values(array_unique(array_filter($names)));
return $asArray ? $names : (!empty($names) ? implode(', ', $names) : '');
return $asArray ? $names : (! empty($names) ? implode(', ', $names) : '');
}
/**
@@ -200,7 +205,9 @@ class StudentClass extends BaseModel
public static function getStudentsByClassSectionIds(array $classSectionIds): array
{
$ids = array_values(array_unique(array_filter(array_map('intval', $classSectionIds))));
if (empty($ids)) return [];
if (empty($ids)) {
return [];
}
return DB::table('student_class as sc')
->selectRaw('
@@ -234,7 +241,7 @@ class StudentClass extends BaseModel
->orderByDesc('created_at')
->first();
if (!$sc || !$sc->class_section_id) {
if (! $sc || ! $sc->class_section_id) {
return 'N/A';
}
@@ -282,7 +289,9 @@ class StudentClass extends BaseModel
$out = [];
foreach ($rows as $r) {
$cid = $r->class_section_id;
if ($cid === null || $cid === '') continue;
if ($cid === null || $cid === '') {
continue;
}
$out[$cid] = (int) ($r->total ?? 0);
}
@@ -298,13 +307,13 @@ class StudentClass extends BaseModel
$req = $updating ? 'sometimes' : 'required';
return [
'student_id' => [$req, 'integer', 'min:1', 'exists:students,id'],
'school_id' => ['nullable', 'integer', 'min:1'],
'student_id' => [$req, 'integer', 'min:1', 'exists:students,id'],
'school_id' => ['nullable', 'integer', 'min:1'],
'class_section_id' => ['nullable', 'integer'],
'school_year' => [$req, 'string', 'max:20'],
'is_event_only' => ['nullable', 'boolean'],
'description' => ['nullable', 'string', 'max:2000'],
'updated_by' => ['nullable', 'integer'],
'school_year' => [$req, 'string', 'max:20'],
'is_event_only' => ['nullable', 'boolean'],
'description' => ['nullable', 'string', 'max:2000'],
'updated_by' => ['nullable', 'integer'],
];
}
}
}