In my the saved(User $user) method in my UserObserver I'm just dumping the $user's groups (dump($user->groups->toArray()), which works fine. However, the list of groups does not reflect what's currently in the database. Instead, it's the previous state.
Example:
A user is in group 1 and 2.
I add them to group 3, which triggers a save and the saved method.
The method will show the user in groups 1 and 2, not 3.
Adding the user to group 4 will now show the user in groups 1, 2, and 3, but not 4.
This is using Laravel 5.8.35
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire