PHP code example of nu1ww / loyalty

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

    

nu1ww / loyalty example snippets


'providers' => [
    Loyalty\LoyaltyServiceProvider::class
];



namespace App;

use Loyalty\Contracts\Loyalty;
use Loyalty\Traits\LoyaltyTrait as LoyaltyTrait;
use Illuminate\Database\Eloquent\Model;

class User extends Model implements Loyalty
{
    use LoyaltyTrait;
}


    $user = \App\User::first();
    $amount = 10;  
    $message = "";
 
    $data = [];
    $transaction = $user->earnPoints($amount, $message, $data);
 


    $user = \App\User::first();
    $amount = 10;  
    $message = "";
 
    $data = [];
    $transaction = $user->burnPoints($amount, $message, $data);
 


$point;
 


$point;
 


$point;
 


$point;
 

php artisan vendor:publish --provider="Loyalty\LoyaltyServiceProvider" && php artisan migrate