Rework service, removed redundant code, service invoicing improvements
This commit is contained in:
@@ -48,11 +48,13 @@ class Broadband extends Type implements ServiceUsage
|
||||
* The usage information for broadband
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
* @todo rename to usage()
|
||||
*/
|
||||
public function traffic()
|
||||
{
|
||||
return $this->hasMany(UsageBroadband::class,'service_item_id')
|
||||
->where('site_id',$this->site_id);
|
||||
->where('date','>=',Carbon::now()->startOfMonth());
|
||||
//->where('site_id',$this->site_id);
|
||||
}
|
||||
|
||||
/* ATTRIBUTES */
|
||||
@@ -154,8 +156,6 @@ class Broadband extends Type implements ServiceUsage
|
||||
if (! $maxdate)
|
||||
return collect();
|
||||
|
||||
Log::debug(sprintf('%s:Getting Usage data for [%d] months from [%s]',self::LOGKEY,$months,$maxdate),['m'=>__METHOD__]);
|
||||
|
||||
// Go back an extra month;
|
||||
$start = $maxdate->date->subMonths($months);
|
||||
|
||||
@@ -166,8 +166,6 @@ class Broadband extends Type implements ServiceUsage
|
||||
$start = $start->subDays($start->day-15);
|
||||
}
|
||||
|
||||
Log::debug(sprintf('%s:Getting Usage data from [%s]',self::LOGKEY,$start->format('Y-m-d')),['m'=>__METHOD__]);
|
||||
|
||||
$result = collect();
|
||||
|
||||
foreach ($this->traffic()
|
||||
|
Reference in New Issue
Block a user