remove the school reference
This commit is contained in:
@@ -2140,21 +2140,9 @@ class ParentController extends BaseController
|
||||
// Loop through students
|
||||
foreach ($incomingFirstNames as $idx => $firstName) {
|
||||
if (!empty($firstName)) {
|
||||
// ✅ 7. Extract is_new flag (convert to boolean)
|
||||
$lastYearKey = 'last_year_' . $idx;
|
||||
$lastYearVal = strtolower(trim($post[$lastYearKey] ?? ''));
|
||||
|
||||
$isNew = match ($lastYearVal) {
|
||||
'yes' => false, // was with us last year => not new
|
||||
'no' => true, // was not with us => new student
|
||||
default => null // missing or invalid
|
||||
};
|
||||
|
||||
if (!isset($isNew)) {
|
||||
return redirect()->back()->withInput()->with('error', "Please select if student #" . ($idx + 1) . " was with us last year.");
|
||||
}
|
||||
|
||||
// ✅ 8. Pass $isNew to the student save function
|
||||
$lastYearVal = strtolower(trim($post[$lastYearKey] ?? 'no'));
|
||||
$isNew = $lastYearVal !== 'yes';
|
||||
$result = $this->validateAndSaveOrUpdateStudent($idx, $parentId, $this->semester, $this->schoolYear, $schoolIdService, $isNew, null);
|
||||
|
||||
if ($result) {
|
||||
|
||||
Reference in New Issue
Block a user