Skip to content

Instantly share code, notes, and snippets.

@bogordesaincom
Created June 26, 2022 11:17
Show Gist options
  • Save bogordesaincom/bf43b10c64d96225b0a19553f210676e to your computer and use it in GitHub Desktop.
Save bogordesaincom/bf43b10c64d96225b0a19553f210676e to your computer and use it in GitHub Desktop.
Stock
<?php
$warehouses = Warehouse::where('companies_id', $companies->id)->get();
$stock_array = [];
foreach($warehouses as $warehouse) {
$stockIn = Stock::where('warehouse_id', $warehouse->id)->where('status', 'stock_in')->sum('kolom table qty')
$stockOut = Stock::where('warehouse_id', $warehouse->id)->where('status', 'stock_out')->sum('kolom table qty')
$stock_array = $stockIn - $stockOut;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment