/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ public function create(array $data) { return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]); }
public function facebookAccount() { return $this->hasOne('Agency\\FacebookSocialAccount', 'SOCIAL_ACCOUNT'); } public function twitterAccount() { return $this->hasOne('Agency\\TwitterSocialAccount', 'SOCIAL_ACCOUNT'); } public function likesComments() { return $this->hasMany('Fahita\\Comment', 'LIKES'); } public function reportedComments() { return $this->hasMany('Fahita\\Comment', 'REPORTED'); } public function getAuthIdentifier() { return $this->id; } public function getAccessToken() { return $this->access_token; } public function emailVerificationCodes() { return $this->hasMany('Agency\\EmailVerificationCode', 'VERIFICATION_CODE'); } } User::observe(new CachingObserver());
/** * Map the given user instance for moderation. * * @param \Agency\User $user * * @return array */ public function mapForModeration(User $user) { return ['id' => (string) $user->getKey(), 'name' => (string) $user->name, 'avatar' => (string) $user->avatar, 'email' => (string) $user->email, 'blocked' => (bool) $user->blocked]; }