2017 © Pedro Peláez
 

library laravel-pointable

Point system for Laravel 5

image

alariva/laravel-pointable

Point system for Laravel 5

  • Tuesday, October 10, 2017
  • by alariva
  • Repository
  • 1 Watchers
  • 1 Stars
  • 15 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 12 Forks
  • 0 Open issues
  • 4 Versions
  • 15 % Grown

The README.md

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

Laravel Pointable

Point Transaction system for Laravel 5, (*2)

Original Package from Trexology, (*3)

Installation

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

composer require alariva/laravel-pointable

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

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

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

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

Setup a Model

<?php

namespace App;

use Alariva\Pointable\Contracts\Pointable;
use Alariva\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/10 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