Because in UsersController::myAccount(), $this->set(compact('user')); comes before $user is modified by the request data, the form always displays what data was in the database before it was changed, rather than the request data that updated what was in the database.
Example:
User's gender is "walrus"
User goes to /users/my-account, changes it to "geode", and submits the form
The database shows the user's gender as being changed to "geode"
The resulting page displays "Your account has been updated", but the form still shows the gender as "walrus"
Refreshing that page queries the database again, and the form now shows the updated gender
Because in
UsersController::myAccount()
,$this->set(compact('user'));
comes before$user
is modified by the request data, the form always displays what data was in the database before it was changed, rather than the request data that updated what was in the database.Example:
/users/my-account
, changes it to "geode", and submits the form