Fix showing all traffic usage for broadband
This commit is contained in:
parent
7e784c3e81
commit
23f23dfe40
@ -52,9 +52,7 @@ class Broadband extends Type implements ServiceUsage
|
|||||||
*/
|
*/
|
||||||
public function traffic()
|
public function traffic()
|
||||||
{
|
{
|
||||||
return $this->hasMany(UsageBroadband::class,'service_item_id')
|
return $this->hasMany(UsageBroadband::class,'service_item_id');
|
||||||
->where('date','>=',Carbon::now()->startOfMonth());
|
|
||||||
//->where('site_id',$this->site_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ATTRIBUTES */
|
/* ATTRIBUTES */
|
||||||
@ -144,9 +142,11 @@ class Broadband extends Type implements ServiceUsage
|
|||||||
*/
|
*/
|
||||||
private function usage_last_date(): ?UsageBroadband
|
private function usage_last_date(): ?UsageBroadband
|
||||||
{
|
{
|
||||||
return $this->traffic
|
return $this->traffic()
|
||||||
->sortBy('date')
|
->orderBy('date','DESC')
|
||||||
->last();
|
->limit(1)
|
||||||
|
->get()
|
||||||
|
->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function usage_summary(int $months=2): Collection
|
public function usage_summary(int $months=2): Collection
|
||||||
|
Loading…
Reference in New Issue
Block a user