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:
parent
5f360c7d3a
commit
8cfb9c1f06
|
|
@ -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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue