Added usage graph (ADSL), improved logging for usage collection (ADSL)

This commit is contained in:
Deon George
2021-02-18 00:22:50 +11:00
parent 338296982b
commit a301fa7fc0
11 changed files with 258 additions and 115 deletions

View File

@@ -28,6 +28,8 @@ class Product extends Model
protected $with = ['descriptions'];
/* RELATIONS */
public function descriptions()
{
return $this->hasMany(ProductTranslate::class);
@@ -48,6 +50,8 @@ class Product extends Model
return $this->morphTo(null,'model','prod_plugin_data');
}
/* ATTRIBUTES */
/**
* Get the service category (from the product)
*
@@ -161,6 +165,17 @@ class Product extends Model
return Arr::get($this->price_array,sprintf('%s.1.price_setup',$this->price_recurr_default))*1.1;
}
/**
* Return if this product captures usage data
*
* @return bool
*/
public function hasUsage(): bool
{
// @todo This should be configured in the DB
return in_array($this->model, ['App\Models\Product\Adsl']);
}
public function scopeActive()
{
return $this->where('active',TRUE);