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
+20 -14
View File
@@ -2,7 +2,6 @@
namespace App\Models;
use App\Models\BaseModel;
use Illuminate\Support\Facades\DB;
class AttendanceRecord extends BaseModel
@@ -28,14 +27,14 @@ class AttendanceRecord extends BaseModel
];
protected $casts = [
'class_section_id' => 'integer',
'student_id' => 'integer',
'school_id' => 'integer',
'total_absence' => 'integer',
'total_late' => 'integer',
'total_presence' => 'integer',
'total_attendance' => 'integer',
'modified_by' => 'integer',
'class_section_id' => 'integer',
'student_id' => 'integer',
'school_id' => 'integer',
'total_absence' => 'integer',
'total_late' => 'integer',
'total_presence' => 'integer',
'total_attendance' => 'integer',
'modified_by' => 'integer',
];
/* =========================
@@ -86,6 +85,7 @@ class AttendanceRecord extends BaseModel
public static function updateAttendanceRecord(int $attendanceId, array $data): bool
{
$affected = static::query()->whereKey($attendanceId)->update($data);
return $affected >= 0;
}
@@ -101,20 +101,26 @@ class AttendanceRecord extends BaseModel
string $schoolYear,
array $increments
): bool {
$allowed = ['total_absence','total_late','total_presence','total_attendance'];
$allowed = ['total_absence', 'total_late', 'total_presence', 'total_attendance'];
$inc = array_intersect_key($increments, array_flip($allowed));
if (empty($inc)) return true;
if (empty($inc)) {
return true;
}
// Build atomic update: field = field + X
$update = [];
foreach ($inc as $field => $value) {
$value = (int) $value;
if ($value === 0) continue;
if ($value === 0) {
continue;
}
$update[$field] = DB::raw("COALESCE($field,0) + {$value}");
}
if (empty($update)) return true;
if (empty($update)) {
return true;
}
$affected = static::query()
->where('student_id', $studentId)
@@ -139,4 +145,4 @@ class AttendanceRecord extends BaseModel
->where('school_year', $schoolYear)
->sum('total_absence');
}
}
}