You can install the package via composer:
composer require chapdel/laravel-credit
You can publish and run the migrations with:
php artisan vendor:publish --provider="Chapdel\Credit\CreditServiceProvider" --tag="laravel-credit-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --provider="Chapdel\Credit\CreditServiceProvider" --tag="laravel-credit-config"
This is the contents of the published config file:
return [
"initial" => 0
];
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Chapdel\Credits\Traits\HasCredits;
class User extends Authenticatable
{
use HasCredits;
}
$user = User::find(1);
$user->initCredits();
$user = User::find(1);
$user->addCredits(500);
$user = User::find(1);
$user->deductCredits(50);
$user = User::find(1);
$user->deductCredits(100);
$user = User::find(1);
$user->credit;
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.