2017 © Pedro Peláez
 

library pointable

Point system for Laravel 5

image

trexology/pointable

Point system for Laravel 5

  • Friday, November 10, 2017
  • by trexology
  • Repository
  • 2 Watchers
  • 30 Stars
  • 723 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 12 Forks
  • 5 Open issues
  • 4 Versions
  • 7 % Grown

The README.md

Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

Laravel Pointable

Point Transaction system for laravel 5, (*2)

Installation

First, pull in the package through Composer., (*3)

composer require trexology/pointable

And then include the service provider within app/config/app.php., (*4)

'providers' => [
    Trexology\Pointable\PointableServiceProvider::class
];

At last you need to publish and run the migration., (*5)

php artisan vendor:publish --provider="Trexology\Pointable\PointableServiceProvider" && php artisan migrate

Setup a Model

<?php

namespace App;

use Trexology\Pointable\Contracts\Pointable;
use Trexology\Pointable\Traits\Pointable as PointableTrait;
use Illuminate\Database\Eloquent\Model;

class User extends Model implements Pointable
{
    use PointableTrait;
}

Add Points

$user = User::first();
$amount = 10; // (Double) Can be a negative value
$message = "The reason for this transaction";

//Optional (if you modify the point_transaction table)
$data = [
    'ref_id' => 'someReferId',
];

$transaction = $user->addPoints($amount,$message,$data);

dd($transaction);

Get Current Points

$user = User::first();
$points = $user->currentPoints();

dd($points);

Get Transactions

$user = User::first();
$user->transactions;

//OR
//$user['transactions'] = $user->transactions(2)->get(); //Get last 2 transactions

dd($user);

Count Transactions

$user = User::first();
$user['transactions_total'] = $user->countTransactions();

dd($user);

The Versions

10/11 2017

dev-master

9999999-dev

Point system for Laravel 5

  Sources   Download

MIT

The Requires

 

by Trex Lim

laravel reward loyalty points pointable

20/02 2017

v1.0.2

1.0.2.0

Point system for Laravel 5

  Sources   Download

MIT

The Requires

 

by Trex Lim

laravel reward loyalty points pointable

14/04 2016

v1.0.1

1.0.1.0

Point system for Laravel 5

  Sources   Download

MIT

The Requires

 

by Trex Lim

laravel reward loyalty points pointable

04/02 2016

v1.0.0

1.0.0.0

Point system for Laravel 5

  Sources   Download

MIT

The Requires

 

by Trex Lim

laravel reward loyalty points pointable