More Product Model optimisation
This commit is contained in:
@@ -4,33 +4,25 @@ namespace App\Models\Supplier;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
use App\Interfaces\SupplierItem;
|
||||
use App\Models\Product\Domain as ProductDomain;
|
||||
use App\Models\TLD;
|
||||
|
||||
final class Domain extends Type implements SupplierItem
|
||||
final class Domain extends Type
|
||||
{
|
||||
protected const category_name = 'Domain Name';
|
||||
protected const category_name = 'Domain';
|
||||
|
||||
protected $table = 'supplier_domain';
|
||||
|
||||
/* INTERFACES */
|
||||
// The model of the product that is supplied by this model
|
||||
const ProductModel = ProductDomain::class;
|
||||
|
||||
public function getBillingIntervalAttribute(): int
|
||||
{
|
||||
return 4; // Yearly
|
||||
}
|
||||
/* INTERFACES */
|
||||
|
||||
public function getNameAttribute(): string
|
||||
{
|
||||
return sprintf('%s: %s',$this->product_id,$this->tld->name);
|
||||
}
|
||||
|
||||
public function products()
|
||||
{
|
||||
return $this->hasMany(ProductDomain::class,'supplier_item_id','id');
|
||||
}
|
||||
|
||||
/* STATIC */
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user