Ejemplo n.º 1
0
 /**
  * Updating user
  *
  * @param User $user
  * @param array $data
  * @return mixed
  */
 public function updateUser(User $user, array $data)
 {
     $user->name = isset($data['name']) ? $data['name'] : $user->name;
     $user->user_name = $data['user_name'];
     $user->email = $data['email'];
     $user->password = isset($data['password']) ? $data['password'] : $user->password;
     $user->voip_id = isset($data['voip_id']) ? $data['voip_id'] : $user->voip_id;
     $user->phone = isset($data['phone']) ? $data['phone'] : $user->phone;
     $user->save();
     return $user;
 }
Ejemplo n.º 2
0
 /**
  * Add roles to user
  *
  * @param $user
  * @param $saveableRoles
  * @return mixed
  */
 public function addRolesToUser(User $user, array $saveableRoles)
 {
     $user->roles()->sync($saveableRoles);
     return $user;
 }
 public function loadUserAvailableCats(User $user)
 {
     return $user->categories()->get();
 }
Ejemplo n.º 4
0
 public function loadUserAvailableStates(User $user)
 {
     return $user->articlesStates()->get();
 }