chapdel/laravel-credit
Composer 安装命令:
composer require chapdel/laravel-credit
包简介
Model credits system for Laravel.
README 文档
README
Installation
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 ];
Usage
Traits
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; }
Interactions
init credits
$user = User::find(1); $user->initCredits();
Add credits
$user = User::find(1); $user->addCredits(500);
Deducting credits
$user = User::find(1); $user->deductCredits(50);
Update credits
$user = User::find(1); $user->deductCredits(100);
Getting credits
$user = User::find(1); $user->credit;
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-11-05