Product class optimisation
This commit is contained in:
@@ -34,17 +34,8 @@ final class Broadband extends Type implements ProductItem
|
||||
// The model that is referenced when this product is ordered
|
||||
protected string $order_model = ServiceBroadband::class;
|
||||
|
||||
/* RELATIONS */
|
||||
|
||||
/**
|
||||
* The offering supplied with this product
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
*/
|
||||
public function supplied()
|
||||
{
|
||||
return $this->hasOne(SupplierBroadband::class,'id','supplier_item_id');
|
||||
}
|
||||
// The model that the supplier supplies
|
||||
const SupplierModel = SupplierBroadband::class;
|
||||
|
||||
/* INTERFACES */
|
||||
|
||||
|
@@ -31,17 +31,8 @@ final class Domain extends Type implements ProductItem
|
||||
// The model that is referenced when this product is ordered
|
||||
protected string $order_model = ServiceDomain::class;
|
||||
|
||||
/* RELATIONS */
|
||||
|
||||
/**
|
||||
* The offering supplied with this product
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
*/
|
||||
public function supplied()
|
||||
{
|
||||
return $this->hasOne(SupplierDomain::class,'id','supplier_item_id');
|
||||
}
|
||||
// The model that the supplier supplies
|
||||
const SupplierModel = SupplierDomain::class;
|
||||
|
||||
/* INTERFACES */
|
||||
|
||||
|
@@ -15,17 +15,8 @@ final class Email extends Type implements ProductItem
|
||||
// The model that is referenced when this product is ordered
|
||||
protected string $order_model = ServiceEmail::class;
|
||||
|
||||
/* RELATIONS */
|
||||
|
||||
/**
|
||||
* The offering supplied with this product
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
*/
|
||||
public function supplied()
|
||||
{
|
||||
return $this->hasOne(SupplierEmail::class,'id','supplier_item_id');
|
||||
}
|
||||
// The model that the supplier supplies
|
||||
const SupplierModel = SupplierEmail::class;
|
||||
|
||||
/* INTERFACES */
|
||||
|
||||
|
@@ -15,17 +15,8 @@ final class Generic extends Type implements ProductItem
|
||||
// The model that is referenced when this product is ordered
|
||||
protected string $order_model = ServiceGeneric::class;
|
||||
|
||||
/* RELATIONS */
|
||||
|
||||
/**
|
||||
* The offering supplied with this product
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
*/
|
||||
public function supplied()
|
||||
{
|
||||
return $this->hasOne(SupplierGeneric::class,'id','supplier_item_id');
|
||||
}
|
||||
// The model that the supplier supplies
|
||||
const SupplierModel = SupplierGeneric::class;
|
||||
|
||||
/* INTERFACES */
|
||||
|
||||
|
@@ -15,17 +15,8 @@ final class Host extends Type implements ProductItem
|
||||
// The model that is referenced when this product is ordered
|
||||
protected string $order_model = ServiceHost::class;
|
||||
|
||||
/* RELATIONS */
|
||||
|
||||
/**
|
||||
* The offering supplied with this product
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
*/
|
||||
public function supplied()
|
||||
{
|
||||
return $this->hasOne(SupplierHost::class,'id','supplier_item_id');
|
||||
}
|
||||
// The model that the supplier supplies
|
||||
const SupplierModel = SupplierHost::class;
|
||||
|
||||
/* INTERFACES */
|
||||
|
||||
|
@@ -42,17 +42,8 @@ final class Phone extends Type implements ProductItem
|
||||
// The model that is referenced when this product is ordered
|
||||
protected string $order_model = ServicePhone::class;
|
||||
|
||||
/* RELATIONS */
|
||||
|
||||
/**
|
||||
* The offering supplied with this product
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
*/
|
||||
public function supplied()
|
||||
{
|
||||
return $this->hasOne(SupplierPhone::class,'id','supplier_item_id');
|
||||
}
|
||||
// The model that the supplier supplies
|
||||
const SupplierModel = SupplierPhone::class;
|
||||
|
||||
/* INTERFACES */
|
||||
|
||||
|
@@ -15,17 +15,8 @@ final class SSL extends Type implements ProductItem
|
||||
// The model that is referenced when this product is ordered
|
||||
protected string $order_model = ServiceSSL::class;
|
||||
|
||||
/* RELATIONS */
|
||||
|
||||
/**
|
||||
* The offering supplied with this product
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
*/
|
||||
public function supplied()
|
||||
{
|
||||
return $this->hasOne(SupplierSSL::class,'id','supplier_item_id');
|
||||
}
|
||||
// The model that the supplier supplies
|
||||
const SupplierModel = SupplierSSL::class;
|
||||
|
||||
/* INTERFACES */
|
||||
|
||||
|
@@ -27,6 +27,16 @@ abstract class Type extends Model
|
||||
return $this->morphMany(Product::class, null,'model','model_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* The offering supplied with this product
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
*/
|
||||
public function supplied()
|
||||
{
|
||||
return $this->hasOne(static::SupplierModel,'id','supplier_item_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* This will return the category of the product (eg: domain, hosting, etc) which is the basis for all
|
||||
* other logic of these types.
|
||||
|
Reference in New Issue
Block a user