osb/app/Models/Product/SSL.php
2022-02-02 10:43:59 +11:00

83 lines
1.3 KiB
PHP

<?php
namespace App\Models\Product;
use Illuminate\Support\Collection;
use App\Interfaces\ProductItem;
use App\Models\Service\SSL as ServiceSSL;
use App\Models\Supplier\SSL as SupplierSSL;
final class SSL extends Type implements ProductItem
{
protected $table = 'product_ssl';
// 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_ssl_id');
}
/* 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 getProductAttribute()
{
$o = new \stdClass();
$o->product_id = 'INT';
$o->setup_cost = 0;
$o->base_cost = 0;
$o->contract_term = 0; // @todo
return $o;
}
public function getSupplierAttribute()
{
$o = new \stdClass();
$o->name = 'Internal';
return $o;
}
public function getTypeAttribute()
{
return 'SSL Certificate';
}
public function hasUsage(): bool
{
return FALSE;
}
}