/**
  * @param array $data
  *
  * @return ParseObject
  */
 public function create(array $data)
 {
     $subClass = ParseObject::getRegisteredSubclass($this->getParseClass());
     $parseClass = new $subClass();
     $this->setValues($data, $parseClass);
     return $parseClass;
 }
Esempio n. 2
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array $data
  *
  * @return User
  */
 public function create(array $data)
 {
     $userSubclass = ParseObject::getRegisteredSubclass('_User');
     $user = new $userSubclass();
     $user->username = isset($data['username']) ? $data['username'] : $data['email'];
     $user->email = $data['email'];
     $user->password = $data['password'];
     $user->signUp();
     return $user;
 }
Esempio n. 3
0
 /**
  * Validate a user against the given credentials.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable $user
  * @param  array                                      $credentials
  *
  * @return bool
  */
 public function validateCredentials(Authenticatable $user, array $credentials)
 {
     try {
         $username = $this->getUsernameFromCredentials($credentials);
         /** @var ParseUser $userClass */
         $userClass = ParseObject::getRegisteredSubclass('_User');
         $userClass::logIn($username, $credentials['password']);
         return true;
     } catch (ParseException $error) {
         return false;
     }
 }