Skip to content

Customer ​

A customer who made a purchase through an affiliate link.

Table: fa_customers
Class: FluentAffiliate\\App\\Models\\Customer.php

Columns ​

ColumnTypeNullableDefaultDescription
idBIGINT(20)NO—Primary key, auto-increment.
user_idBIGINT(20)YES—WordPress user ID of the affiliate.
by_affiliate_idBIGINT(20)YES—Affiliate who referred this customer.
emailVARCHAR(192)YES—Customer email address.
first_nameVARCHAR(192)YES—Customer first name.
last_nameVARCHAR(192)YES—Customer last name.
ipVARCHAR(100)YES—Hashed or raw visitor IP address.
settingsLONGTEXTYES—Serialized JSON settings blob.
created_atTIMESTAMPYES—Timestamp when the record was created.
updated_atTIMESTAMPYES—Timestamp when the record was last updated.

Relationships ​

MethodTypeTargetDescription
affiliate()belongsToAffiliateThe affiliate who referred this customer.
referrals()hasManyReferralAll referrals from this customer.

Query Scopes ​

ScopeDescription
searchBy($search)Search by email, first name, or last name.

Usage Example ​

php
use FluentAffiliate\App\Models\Customer;

$customer = Customer::where('email', $email)->first();

FluentAffiliate developer documentation