Fix BadMethodCallException and remaining PostgreSQL issues
This commit is contained in:
@@ -84,6 +84,17 @@ public function dueCollect()
|
||||
{
|
||||
return $this->hasOne(DueCollect::class);
|
||||
}
|
||||
public function dueForBranch($branchId = null)
|
||||
{
|
||||
$query = $this->type === 'Supplier' ? $this->purchases_dues() : $this->sales_dues();
|
||||
|
||||
if ($branchId) {
|
||||
$query->where('branch_id', $branchId);
|
||||
}
|
||||
|
||||
return $query->sum('dueAmount');
|
||||
}
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user