0.4.3 2021-07-17 07:00 UTC

This package is auto-updated.

Last update: 2021-08-22 18:09:50 UTC


README

SierraTecnologia Gamer Various functionality, and basic controller included out-of-the-box.

Packagist Scrutinizer Code Quality Travis StyleCI License

[x] Point Transaction system for laravel X

Installation

Install via composer require sierratecnologia/gamer

And then include the service provider within app/config/app.php.

'providers' => [
    Gamer\PointableServiceProvider::class
];

At last you need to publish and run the migration.

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

Setup a Model

<?php

namespace App;

use Gamer\Contracts\Pointable;
use Gamer\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);

Changelog

Refer to the Changelog for a full history of the project.

Support

The following support channels are available at your fingertips:

Contributing & Protocols

Thank you for considering contributing to this project! The contribution guide can be found in CONTRIBUTING.md.

Bug reports, feature requests, and pull requests are very welcome.

Security Vulnerabilities

If you discover a security vulnerability within this project, please send an e-mail to help@sierratecnologia.com.br. All security vulnerabilities will be promptly addressed.

About SierraTecnologia

SierraTecnologia is a software solutions startup, specialized in integrated enterprise solutions for SMEs established in Rio de Janeiro, Brazil since June 2008. We believe that our drive The Value, The Reach, and The Impact is what differentiates us and unleash the endless possibilities of our philosophy through the power of software. We like to call it Innovation At The Speed Of Life. That’s how we do our share of advancing humanity.

License

This software is released under The MIT License (MIT).

(c) 2008-2020 SierraTecnologia, Some rights reserved.