app/Http/Controllers/Auth/RegisterController.php
/**
     * Create a new user instance after a valid registration.
     *
     * @param  array  $data
     * @return User
     */
Create a new user instance after a valid registration.
@param  array  $data
@return User
Create a new user instance after a valid registration . @param array $data @return User
protected function create(array $data)
    {
        $user = User::create([
            'name'      => $data['name'],
            'email'     => $data['email'],
            'password'  => bcrypt($data['password']),
        ]);
        $user->profile()->create([
            'first_name'    => $data['first_name'],
            'last_name'     => $data['last_name'],
            'account_type'  => 1,
            'is_public'     => true,
        ]);
        $verify_key = Crypt::encryptString($data['email']);
        $user->verifyUser()->create([
            'verify_key' => $verify_key
        ]);
        $inviteCheck = ContactInvite::where('email', $data['email'])->first();
        if($inviteCheck){
            $invitee = User::where('email', $inviteCheck->invitee_email)->first();
            if($invitee){
                $point = new PointService(config('services.points'));
                $point->addPoint($invitee, 'invite_signup');
            }
            Mail::to($inviteCheck->invitee_email)->send(new InviteAccepted($inviteCheck->invitee_name, $data['first_name'], $data['name']));
            $inviteCheck->delete();
        }
        event(new UserEvents($user));
        return $user;
    }
protected function create ( array $ data ) { $ user = User :: create ( [ 'name' => $ data [ 'name' ] , 'email' => $ data [ 'email' ] , 'password' => bcrypt ( $ data [ 'password' ] ) , ] ) ; $ user -> profile ( ) -> create ( [ 'first_name' => $ data [ 'first_name' ] , 'last_name' => $ data [ 'last_name' ] , 'account_type' => 1 , 'is_public' => true , ] ) ; $ verify_key = Crypt :: encryptString ( $ data [ 'email' ] ) ; $ user -> verifyUser ( ) -> create ( [ 'verify_key' => $ verify_key ] ) ; $ inviteCheck = ContactInvite :: where ( 'email' , $ data [ 'email' ] ) -> first ( ) ; if ( $ inviteCheck ) { $ invitee = User :: where ( 'email' , $ inviteCheck -> invitee_email ) -> first ( ) ; if ( $ invitee ) { $ point = new PointService ( config ( 'services.points' ) ) ; $ point -> addPoint ( $ invitee , 'invite_signup' ) ; } Mail :: to ( $ inviteCheck -> invitee_email ) -> send ( new InviteAccepted ( $ inviteCheck -> invitee_name , $ data [ 'first_name' ] , $ data [ 'name' ] ) ) ; $ inviteCheck -> delete ( ) ; } event ( new UserEvents ( $ user ) ) ; return $ user ; }
Create a new user instance after a valid registration.
Create a new user instance after a valid registration .
// Generate user verify token and store in database // Dispatch the event to send the email // Return the newly created user