PHP code example of appstract / laravel-stock

1. Go to this page and download the library: Download appstract/laravel-stock library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

appstract / laravel-stock example snippets


$book->increaseStock(10);
$book->decreaseStock(10);
$book->mutateStock(10);
$book->mutateStock(-10);

$book->clearStock();
$book->clearStock(10);

$book->setStock(10);

$book->inStock();
$book->inStock(10);

$book->stock;
$book->stock(Carbon::now()->subDays(10));

$book->increaseStock(10, [
    'description' => 'This is a description',
    'reference' => $otherModel,
]);

Book::whereInStock()->get();
Book::whereOutOfStock()->get();