Rubenwouters\CrmLauncher\Models\Contact::getContact PHP Method

getContact() public method

Check if contact exists, if not create a new user
public getContact ( string $type, string $id ) : collection
$type string
$id string
return collection
    public function getContact($type, $id)
    {
        if ($type == 'twitter' && Contact::where('twitter_id', $id)->exists()) {
            return Contact::findByTwitterId($id);
        } else {
            if ($type == 'facebook' && Contact::where('facebook_id', $id)->exists()) {
                return Contact::findByFbId($id);
            }
        }
        return new Contact();
    }