More Product Model optimisation

This commit is contained in:
2023-05-05 15:48:24 +10:00
parent 96f799f535
commit 820ff2be00
37 changed files with 161 additions and 592 deletions

View File

@@ -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 */
/**