Update and fix broadband traffic
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Collection;
|
||||
@@ -62,7 +63,8 @@ class Supplier extends Model
|
||||
// EG: Crazy Domains, "domains" and "hosting".
|
||||
public function detail()
|
||||
{
|
||||
return $this->hasOne(SupplierDetail::class);
|
||||
return $this->hasOne(SupplierDetail::class)
|
||||
->withoutGlobalScope(\App\Models\Scopes\SiteScope::class);
|
||||
}
|
||||
|
||||
/* METHODS */
|
||||
@@ -103,4 +105,18 @@ class Supplier extends Model
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the traffic records, that were not matched to a service.
|
||||
*
|
||||
* @param Carbon $date
|
||||
* @return \Illuminate\Database\Eloquent\Collection
|
||||
*/
|
||||
public function trafficMismatch(Carbon $date): Collection
|
||||
{
|
||||
return Usage\Broadband::where('date',$date->format('Y-m-d'))
|
||||
->where('supplier_id',$this->id)
|
||||
->whereNULL('service_item_id')
|
||||
->get();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user