public function create($user, $password, $role = 'member', $sendEmail = false)
    {
        try {
            DB::transaction(function () use ($user, $password, $role, $sendEmail) {
                $this->userMeta->firstOrCreate([
                    'user_id' => $user->id
                ]);

                $this->assignRole($role, $user->id);

                if ($sendEmail) {
                    event(new UserRegisteredEmail($user, $password));
                }
            });

            $this->setAndSendUserActivationToken($user);

            return $user;
        } catch (Exception $e) {
            throw new Exception("We were unable to generate your profile, please try again later.", 1);
        }
    }
public function create($user, $password, $role = 'member', $sendEmail = false)
    {
        try {
            DB::transaction(function () use ($user, $password, $role, $sendEmail) {
                $this->userMeta->firstOrCreate([
                    'user_id' => $user->id
                ]);

                $this->assignRole($role, $user->id);

                if ($sendEmail) {
                    event(new UserRegisteredEmail($user, $password));
                }
            });

            $this->setAndSendUserActivationToken($user);

            return $user;
        } catch (Exception $e) {
            throw new Exception("We were unable to generate your profile, please try again later.", 1);
        }
    }
public function create ( $ user , $ password , $ role = 'member' , $ sendEmail = false ) { try { DB :: transaction ( function ( ) use ( $ user , $ password , $ role , $ sendEmail ) { $ this -> userMeta -> firstOrCreate ( [ 'user_id' => $ user -> id ] ) ; $ this -> assignRole ( $ role , $ user -> id ) ; if ( $ sendEmail ) { event ( new UserRegisteredEmail ( $ user , $ password ) ) ; } } ) ; $ this -> setAndSendUserActivationToken ( $ user ) ; return $ user ; } catch ( Exception $ e ) { throw new Exception ( "We were unable to generate your profile, please try again later." , 1 ) ; } }
Create a user's profile

@param  User $user User
@param  string $password the user password
@param  string $role the role of this user
@param  boolean $sendEmail Whether to send the email or not
@return User
Create a user s profile