Download the PHP package mreduar/laravel-balance without Composer
On this page you can find all versions of the php package mreduar/laravel-balance. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mreduar/laravel-balance
More information about mreduar/laravel-balance
Files in mreduar/laravel-balance
Package laravel-balance
Short Description Maintains a history of balance movements in the eloquent models. This simple package will keep track of the balance of your models. You can increase, decrease, reset and set the balance. It is also possible to check if a model has a positive balance or no balance.
License MIT
Homepage https://github.com/mreduar/laravel-balance
Informations about the package laravel-balance
Laravel Balance
Maintains a history of balance movements in the eloquent models. This simple package will keep track of the balance of your models. You can increase, decrease, reset and set the balance. It is also possible to check if a model has a positive balance or no balance.
Installation
You can install the package via composer:
You can publish and run the migrations with:
You can publish the config file with:
This is the contents of the published config file:
Usage
Adding the HasBalance
trait will enable balance functionality on the Model.
Basic operations
Reset balance
It's also possible to reset the balance and directly setting a new value.
Check if model has balance
Check if there is a positive balance or a balance greater than that provided.
Check if model has no balance
Check if there is no more balance.
Add reference and description to history
It is possible to add a reference to any of the above methods by passing an array as a second parameter with the data of the referenced model and a description.
Contributing
Please see CONTRIBUTING for details.
License
The MIT License (MIT). Please see License File for more information.