Download the PHP package caryley/laravel-inventory without Composer
On this page you can find all versions of the php package caryley/laravel-inventory. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download caryley/laravel-inventory
More information about caryley/laravel-inventory
Files in caryley/laravel-inventory
Package laravel-inventory
Short Description Inventory feature for laravel models.
License MIT
Homepage https://github.com/caryley/laravel-inventory
Informations about the package laravel-inventory
Laravel Inventory
The Laravel Inventory package helps track an inventory on any Laravel model.
The package offers the following functionality:
- Create and set a new inventory
- Retrieve the current inventory
- Manage inventory quantity
- Clear an inventory
- Determine if the model is in inventory or not.
- Determine if the model has a valid inventory
- Query scopes for inventoriable model
Installation
Publish the migration with:
Or optionaly publish togther with config
file:
Migrate inventories
table:
Usage
Add the HasInventory
trait to the model.
hasValidInventory()
setInventory()
currentInventory()
addInventory()
incrementInventory()
subtractInventory()
decrementInventory()
inInventory()
notInInventory()
clearInventory()
Scopes
InventoryIs()
- The scope accepts the first argument as quantity, the second argument as the operator, and the third argument as a model id or array of ids.
InventoryIsNot()
- The scope accepts a first argument of a quantity and a second argument of a model id or array of ids
Change log
Please see the changelog for more information on what has changed recently.
Testing
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover any security related issues, please email author email instead of using the issue tracker.
Credits
- Tal Elmishali
- All Contributors
Acknowledgements
Laravel-Inventory draws inspiration from spatie/laravel-model-status & appstract/laravel-stock (even though it doesn't rely on any of them).
License
license. Please see the license file for more information.