Fix Laravel Pint formatting
This commit is contained in:
@@ -12,7 +12,7 @@ class StudentProfileService
|
||||
public function updateStudent(int $studentId, array $payload): array
|
||||
{
|
||||
$student = Student::query()->find($studentId);
|
||||
if (!$student) {
|
||||
if (! $student) {
|
||||
return ['ok' => false, 'message' => 'Student not found.'];
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class StudentProfileService
|
||||
$shouldSyncAllergies = array_key_exists('allergies', $payload);
|
||||
|
||||
DB::transaction(function () use ($student, $studentData, $conditions, $allergies): void {
|
||||
if (!empty($studentData)) {
|
||||
if (! empty($studentData)) {
|
||||
$student->update($studentData);
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ class StudentProfileService
|
||||
|
||||
private function syncHealthList(int $studentId, string $modelClass, string $field, array $newValues): void
|
||||
{
|
||||
$model = new $modelClass();
|
||||
$model = new $modelClass;
|
||||
$rows = $model->newQuery()->where('student_id', $studentId)->get(['id', $field])->toArray();
|
||||
|
||||
$current = [];
|
||||
@@ -111,14 +111,14 @@ class StudentProfileService
|
||||
$toDeleteKeys = array_diff(array_keys($current), array_keys($incoming));
|
||||
$toInsertKeys = array_diff(array_keys($incoming), array_keys($current));
|
||||
|
||||
if (!empty($toDeleteKeys)) {
|
||||
if (! empty($toDeleteKeys)) {
|
||||
$ids = array_map(fn ($key) => $byId[$key], $toDeleteKeys);
|
||||
if (!empty($ids)) {
|
||||
if (! empty($ids)) {
|
||||
$model->newQuery()->whereIn('id', $ids)->delete();
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($toInsertKeys)) {
|
||||
if (! empty($toInsertKeys)) {
|
||||
$batch = [];
|
||||
foreach ($toInsertKeys as $key) {
|
||||
$batch[] = [
|
||||
@@ -126,7 +126,7 @@ class StudentProfileService
|
||||
$field => $incoming[$key],
|
||||
];
|
||||
}
|
||||
if (!empty($batch)) {
|
||||
if (! empty($batch)) {
|
||||
$model->newQuery()->insert($batch);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user