1. Go to this page and download the library: Download a2zwebltd/laravel-affiliate library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
a2zwebltd / laravel-affiliate example snippets
use A2ZWeb\Affiliate\Contracts\RevenueResolver;
class StripeRevenueResolver implements RevenueResolver
{
public function revenueCentsForUserMonth(int $userId, int $year, int $month): int
{
// Sum realised revenue (paid invoices) for $userId in (year, month).
return (int) Invoice::query()
->where('user_id', $userId)
->whereYear('paid_at', $year)
->whereMonth('paid_at', $month)
->sum('amount_cents');
}
}