Exemplo n.º 1
0
 public function registerUser($name, $email, $password, $gender, $facebookId = null, $twitterId = null, $profileImage = "", $is_public = false)
 {
     $user = new User();
     $user->name = $name;
     $user->password = is_null($password) ? null : bcrypt($password);
     $user->email = $email;
     $user->twitter_id = $twitterId;
     $user->facebook_id = $facebookId;
     $user->save();
     $profile = new Profile();
     $profile->name = $name;
     $profile->user_id = $user->id;
     $profile->gender = $gender;
     $profile->profile_image_url = $profileImage;
     $profile->description = "";
     $profile->is_public = $is_public;
     $profile->save();
     return $user;
 }
Exemplo n.º 2
0
 public function save($userId, $data)
 {
     $profile = Profile::where("user_id", "=", $userId)->first();
     $profile->name = $data['name'];
     $profile->description = $data['description'];
     $profile->place = $data['place'];
     $profile->resource_introduce = $data['resource_introduce'];
     $profile->resource_needed = $data['resource_needed'];
     $profile->gender = $data['gender'];
     $profile->is_public = $data['is_public'] === 'true' || $data['is_public'] === true;
     $profile->save();
     return $profile;
 }