Esempio n. 1
0
 /**
  * @param User  $user
  * @param array $data
  *
  * @return bool
  */
 public function update(User $user, array $data)
 {
     $user->fill(['name' => $data['name'], 'email' => $data['email'], 'birthday_at' => $data['birthday_at'], 'gender' => $data['gender'], 'locale' => $data['locale'], 'city' => $data['city'], 'about' => $data['about'], 'profession' => $data['profession'], 'hobbies' => $data['hobbies'], 'homepage' => $data['homepage'], 'skype' => $data['skype'], 'facebook' => $data['facebook'], 'twitter' => $data['twitter'], 'main_character' => $data['main_character'], 'main_guild' => $data['main_guild'], 'favorite_race' => $data['favorite_race'], 'favorite_class' => $data['favorite_class'], 'favorite_spec' => $data['favorite_spec'], 'favorite_instance' => $data['favorite_instance'], 'favorite_battleground' => $data['favorite_battleground']]);
     // only fill password if specified
     if (array_key_exists('password', $data) && !empty($data['password'])) {
         $user->fill(['password' => bcrypt($data['password'])]);
     }
     return $user->save();
 }