PHP code example of titonova / laravel-referral

1. Go to this page and download the library: Download titonova/laravel-referral 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/ */

    

titonova / laravel-referral example snippets




namespace App\Models;

use Famdirksen\LaravelReferral\Contracts\CanReferralContract;
use Famdirksen\LaravelReferral\Traits\CanReferralTrait;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable implements CanReferralContract
{
    use CanReferralTrait;
    
    //
}



namespace App;

use Famdirksen\LaravelReferral\Contracts\HandleReferralContract;
use Famdirksen\LaravelReferral\Traits\HandleReferralTrait;
use Illuminate\Database\Eloquent\Model;

class Order extends Model implements HandleReferralContract
{
    use HandleReferralTrait;
    
    //
}



namespace App\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel
{
    protected $middlewareGroups = [
        'web' => [
            //
            
            \Famdirksen\LaravelReferral\Http\Middleware\CheckReferralMiddleware::class,
            
            //
        ],
    ];
    
    //
}

$user = auth()->user();
$user->referralAccounts();