1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
<?php
use Illuminate\Database\Capsule\Manager as DB; use Carbon\Carbon as Carbon;
class WarehouseProductsku extends BaseModel{ protected $table = "warehouse_productsku";
public function warehouse(){ return $this->belongsTo('Warehouse'); }
public function proProductSku(){ return $this->belongsTo('ProProductSku', 'sku_id'); }
public function getQty(){ return Inventory::whereDeleted(0) ->where('warehouse_id', $warehouseProductsku->warehouse_id) ->where('productsku_id', $warehouseProductsku->sku_id) ->where('qty', '>', 0) ->sum('qty'); } }
|