protected function findOrCreateMember(AccessToken $token, AbstractProvider $provider)
    {
        $user = $provider->getResourceOwner($token);

        /** @var Passport $passport */
        $passport = Passport::get()->filter([
            'Identifier' => $user->getId()
        ])->first();

        if (!$passport) {
            // Create the new member
            $member = $this->createMember($token, $provider);

            // Create a passport for the new member
            $passport = Passport::create()->update([
                'Identifier' => $user->getId(),
                'MemberID' => $member->ID
            ]);
            $passport->write();
        }

        return $passport->Member();
    }
protected function findOrCreateMember(AccessToken $token, AbstractProvider $provider)
    {
        $user = $provider->getResourceOwner($token);

        /** @var Passport $passport */
        $passport = Passport::get()->filter([
            'Identifier' => $user->getId()
        ])->first();

        if (!$passport) {
            // Create the new member
            $member = $this->createMember($token, $provider);

            // Create a passport for the new member
            $passport = Passport::create()->update([
                'Identifier' => $user->getId(),
                'MemberID' => $member->ID
            ]);
            $passport->write();
        }

        return $passport->Member();
    }
protected function findOrCreateMember ( AccessToken $ token , AbstractProvider $ provider ) { $ user = $ provider -> getResourceOwner ( $ token ) ; /** @var Passport $passport */ $ passport = Passport :: get ( ) -> filter ( [ 'Identifier' => $ user -> getId ( ) ] ) -> first ( ) ; if ( ! $ passport ) { // Create the new member $ member = $ this -> createMember ( $ token , $ provider ) ; // Create a passport for the new member $ passport = Passport :: create ( ) -> update ( [ 'Identifier' => $ user -> getId ( ) , 'MemberID' => $ member -> ID ] ) ; $ passport -> write ( ) ; } return $ passport -> Member ( ) ; }
Find or create a member from the given access token

@param AccessToken $token
@param AbstractProvider $provider
@return Member
@throws ValidationException
Find or create a member from the given access token