Optimising product category and category names

This commit is contained in:
Deon George
2022-06-12 11:21:20 +10:00
parent 360c1e46a1
commit cc94426902
36 changed files with 269 additions and 156 deletions

View File

@@ -105,12 +105,13 @@ class Broadband extends Type implements ServiceUsage
* Return the suppliers offering that this service is providing
*
* @return SupplierType
* @todo This column provided_adsl_plan_id should either be deprecated or renamed.
*/
public function supplied(): SupplierType
{
return $this->provided_adsl_plan_id
? SupplierBroadband::findOrFail($this->provided_adsl_plan_id)
: $this->service->product->type->supplied;
: $this->service->offering->supplied;
}
/**

View File

@@ -91,11 +91,6 @@ abstract class Type extends Model implements ServiceItem
return LeenooksCarbon::create($value);
}
public function getTypeAttribute()
{
return strtolower((new \ReflectionClass($this))->getShortName());
}
/* METHODS */
/**
@@ -105,6 +100,6 @@ abstract class Type extends Model implements ServiceItem
*/
public function supplied(): SupplierType
{
return $this->service->product->type->supplied;
return $this->service->offering->supplied ?: new \App\Models\Supplier\Generic();
}
}