Exemple #1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  UserFormRequest $userForm
  * @param  User            $user
  * @return \Illuminate\Http\Response
  */
 public function update(UserFormRequest $userForm, User $user)
 {
     $user->update($userForm->all());
     return Redirect::route('admin.users.show', $user->id)->with('message', 'User has been updated.');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param UserFormRequest $userForm
  * @param User            $user
  *
  * @return \Illuminate\Http\Response
  */
 public function update(UserFormRequest $userForm, User $user)
 {
     $userData = $userForm->all();
     // massage data
     if (gettype($userData['disabled']) == 'string') {
         $userData['disabled'] = $userData['disabled'] == 'true';
     }
     Log::info($userData);
     if (empty($userData['password'])) {
         unset($userData['password']);
     }
     // update the user with the data
     $user->update($userData);
     // link the roles to the user
     $roles = $userForm->get('roles');
     if ($roles == null) {
         $roles = [];
     }
     $user->roles()->sync($roles);
     return Redirect::route('admin.users.show', $user->id)->with('message', 'User has been updated.');
 }