osb/app/Models/Product/Domain.php

74 lines
1.5 KiB
PHP

<?php
namespace App\Models\Product;
use Illuminate\Support\Collection;
use App\Interfaces\ProductItem;
use App\Models\Invoice;
use App\Models\Service\Domain as ServiceDomain;
use App\Models\Supplier\Domain as SupplierDomain;
final class Domain extends Type implements ProductItem
{
protected $table = 'product_domain';
// Information required during the order process
protected array $order_attributes = [
'options.domain'=>[
'request'=>'options.domain',
'key'=>'domain_name',
'validation'=>'required|min:3',
'validation_message'=>'Domain Name is a required field.',
],
'options.tld_id'=>[
'request'=>'options.tld_id',
'key'=>'tld_id',
'validation'=>'required|exists:tlds,id',
'validation_message'=>'Domain TLD is a required field.',
],
];
// The model that is referenced when this product is ordered
protected string $order_model = ServiceDomain::class;
// When comparing billing/pricing/charging, what metric to normalise to
const DefaultBill = Invoice::BILL_YEARLY;
// The model that the supplier supplies
const SupplierModel = SupplierDomain::class;
/* INTERFACES */
public function allowance(): Collection
{
// N/A
return collect();
}
public function allowance_string(): string
{
// N/A
return '';
}
public function getContractTermAttribute(): int
{
return 12;
}
public function getCostAttribute(): float
{
// N/A
return 0;
}
public function getSupplierAttribute()
{
return '';
}
public function hasUsage(): bool
{
return FALSE;
}
}