Example #1
0
 /**
  * Create a new user.
  *
  * @param mixed  $credentials (email, username, password)
  * @return \stdclass
  */
 public function create(array $credentials = [])
 {
     $object = app('stdClass');
     $object->username = $credentials['username'];
     $object->email = $credentials['email'];
     $object->password = $credentials['password'];
     $object->role = UserRoleService::ROLE_ID_MEMBER;
     $user = $this->userRepo->create($object);
     // user_mail_notifictionsテーブルにレコード挿入
     $this->mailNotifyRepo->insert(['user_id' => $user->id, 'comment_notification_flag' => 0, 'favorite_notification_flag' => 0, 'like_notification_flag' => 0, 'edit_notification_flag' => 0]);
     return $user;
 }
Example #2
0
 /**
  * Update mail setting
  *
  * @param int     $userId
  * @param string  $type
  * @param string  $flag
  *
  * @return bool
  */
 public function updateSetting($userId, $type, $flag)
 {
     $columnName = $this->getFlagColomunName($type);
     return !!$this->mailNotify->update([$columnName => $flag === 'true' ? 1 : 0], ['user_id' => $userId]);
 }