If a user chooses a school, and they're the only director at that school, they'll be made head.

This commit is contained in:
Matt Young 2025-08-18 20:07:40 -05:00
parent 5f360c7d3a
commit 8cfb9c1f06
1 changed files with 6 additions and 0 deletions

View File

@ -40,6 +40,12 @@ class UserController extends Controller
'school_id' => request('school_id'), 'school_id' => request('school_id'),
]); ]);
$user->refresh();
if ($user->school->users->count() < 2) {
$user->addFlag('head_director');
}
return redirect('/my_school'); return redirect('/my_school');
} }
} }