1. Go to this page and download the library: Download pdazcom/laravel-referrals 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/ */
namespace App\ReferralPrograms;
use Pdazcom\Referrals\Programs\AbstractProgram;
class ExampleProgram extends AbstractProgram {
const ROYALTY_PERCENT = 30;
/**
* It can be anything that will allow you to calculate the reward.
*
* @param $rewardObject
*/
public function reward($rewardObject)
{
$this->recruitUser->balance = $this->recruitUser->balance + $rewardObject * (self::ROYALTY_PERCENT/100);
$this->recruitUser->save();
}
}