2020-02-18 11:35:20 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
2020-05-28 05:08:13 +00:00
|
|
|
use App\Models\Service\AdslTraffic;
|
|
|
|
use Carbon\Carbon;
|
|
|
|
use Illuminate\Database\Eloquent\Collection;
|
2020-02-18 11:35:20 +00:00
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
2021-12-24 01:14:01 +00:00
|
|
|
/**
|
|
|
|
* @deprecated
|
|
|
|
*/
|
2020-02-18 11:35:20 +00:00
|
|
|
class AdslSupplier extends Model
|
|
|
|
{
|
|
|
|
protected $table = 'ab_adsl_supplier';
|
2020-05-28 05:08:13 +00:00
|
|
|
|
|
|
|
protected $dates = [
|
|
|
|
'stats_lastupdate',
|
|
|
|
];
|
|
|
|
|
|
|
|
public $timestamps = FALSE;
|
|
|
|
|
|
|
|
/** SCOPES */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Only query active categories
|
|
|
|
*/
|
|
|
|
public function scopeActive($query)
|
|
|
|
{
|
|
|
|
return $query->where('active',TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** METHODS **/
|
|
|
|
|
2021-02-17 13:22:50 +00:00
|
|
|
/**
|
|
|
|
* Return the traffic records, that were not matched to a service.
|
|
|
|
*
|
|
|
|
* @param Carbon $date
|
|
|
|
* @return Collection
|
|
|
|
*/
|
|
|
|
public function trafficMismatch(Carbon $date): Collection
|
2020-05-28 05:08:13 +00:00
|
|
|
{
|
|
|
|
return AdslTraffic::where('date',$date->format('Y-m-d'))
|
|
|
|
->where('supplier_id',$this->id)
|
|
|
|
->whereNULL('ab_service_adsl_id')
|
|
|
|
->get();
|
|
|
|
}
|
2020-02-18 11:35:20 +00:00
|
|
|
}
|