Account next invoice, and authorisations
This commit is contained in:
@@ -60,9 +60,11 @@ class Account extends Model
|
||||
return $this->hasMany(Payment::class);
|
||||
}
|
||||
|
||||
public function services()
|
||||
public function services($active=FALSE)
|
||||
{
|
||||
return $this->hasMany(Service::class);
|
||||
$query = $this->hasMany(Service::class);
|
||||
|
||||
return $active ? $query->where('active','=',TRUE) : $query;
|
||||
}
|
||||
|
||||
public function user()
|
||||
@@ -150,7 +152,7 @@ class Account extends Model
|
||||
|
||||
public function getServicesCountHtmlAttribute()
|
||||
{
|
||||
return sprintf('%s <small>/%s</small>',$this->services->where('active',TRUE)->count(),$this->services->count());
|
||||
return sprintf('%s <small>/%s</small>',$this->services()->noEagerLoads()->where('active',TRUE)->count(),$this->services()->noEagerLoads()->count());
|
||||
}
|
||||
|
||||
public function getSwitchUrlAttribute()
|
||||
|
Reference in New Issue
Block a user