Download the PHP package mendela92/laravel-stock without Composer
On this page you can find all versions of the php package mendela92/laravel-stock. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mendela92/laravel-stock
More information about mendela92/laravel-stock
Files in mendela92/laravel-stock
Package laravel-stock
Short Description Keep stock for Eloquent models
License MIT
Homepage https://github.com/mendela1992/laravel-stock
Informations about the package laravel-stock
Laravel Stock
//: # ()
Keep stock for Eloquent models. This package will track stock mutations for your models. You can increase, decrease, clear and set stock. It's also possible to check if a model is in stock (on a certain date/time). But also watches the level of stock of a model and sends a notification via Email
This package was originally a fork form laravel-stock
Functionality
- Increase stocks
- Decrease stocks
- Clear stocks
- Set stocks
- Check if model has stock or not (on a certain date/time).
- Send notification when a pre-defined stock level is reached
Installation
You can install the package via composer:
By running php artisan vendor:publish --provider="Mendela92\Stock\StockServiceProvider"
, it will publish migrations and config file.
The configuration file looks this:
Run php artisan migrate
to migrate the table. There will now be a stocks
table in your database.
Usage
Adding the HasStock
trait will enable stock functionality on the Model.
Basic mutations
Clearing stock
It's also possible to clear the stock and directly setting a new value.
Setting stock
It is possible to set stock. This will create a new mutation with the difference between the old and new value.
Check if model is in stock
It's also possible to check if a product is in stock (with a minimal value).
Current stock
Get the current stock value (on a certain date).
Stock arguments
Add a description and/or reference model to de StockMutation.
Query Scopes
It is also possible to query based on stock.
Testing
Contributing
Contributions are welcome, thanks to y'all :)
License
The MIT License (MIT). Please see License File for more information.