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)NOPrimary key, auto-increment.
user_idBIGINT(20)YESWordPress user ID of the affiliate.
by_affiliate_idBIGINT(20)YESAffiliate who referred this customer.
emailVARCHAR(192)YESCustomer email address.
first_nameVARCHAR(192)YESCustomer first name.
last_nameVARCHAR(192)YESCustomer last name.
ipVARCHAR(100)YESHashed or raw visitor IP address.
settingsLONGTEXTYESSerialized JSON settings blob.
created_atTIMESTAMPYESTimestamp when the record was created.
updated_atTIMESTAMPYESTimestamp 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();

Released under the GPL-2.0 License.