Stevebauman\Inventory\Traits\InventoryTrait::getStockFromLocation PHP Метод

getStockFromLocation() публичный Метод

Retrieves an inventory stock from a given location.
public getStockFromLocation ( Model $location ) : mixed
$location Illuminate\Database\Eloquent\Model
Результат mixed
    public function getStockFromLocation(Model $location)
    {
        $stock = $this->stocks()->where('location_id', $location->getKey())->first();
        if ($stock) {
            return $stock;
        } else {
            $message = Lang::get('inventory::exceptions.StockNotFoundException', ['location' => $location->getAttribute('name')]);
            throw new StockNotFoundException($message);
        }
    }