2019-07-02 05:28:27 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models\Product;
|
|
|
|
|
2022-02-01 05:40:46 +00:00
|
|
|
use Illuminate\Support\Collection;
|
2019-07-02 05:28:27 +00:00
|
|
|
|
2022-02-01 05:40:46 +00:00
|
|
|
use App\Interfaces\ProductItem;
|
|
|
|
use App\Models\Service\Voip as ServiceVoip;
|
|
|
|
use App\Models\Supplier\Voip as SupplierVoip;
|
2021-12-24 01:14:01 +00:00
|
|
|
|
2022-02-01 05:40:46 +00:00
|
|
|
final class Voip extends Type implements ProductItem
|
|
|
|
{
|
|
|
|
protected $table = 'product_voip';
|
2021-12-24 01:14:01 +00:00
|
|
|
|
|
|
|
protected $order_attributes = [
|
|
|
|
'options.phonenumber'=>[
|
|
|
|
'request'=>'options.phonenumber',
|
|
|
|
'key'=>'service_number',
|
|
|
|
'validation'=>'nullable|size:10|unique:ab_service__voip,service_number',
|
|
|
|
'validation_message'=>'Phone Number is a required field.',
|
|
|
|
],
|
|
|
|
'options.supplier'=>[
|
|
|
|
'request'=>'options.supplier',
|
|
|
|
'key'=>'order_info.supplier',
|
|
|
|
'validation'=>'required_with:options.phonenumber',
|
|
|
|
'validation_message'=>'Phone Supplier is a required field.',
|
|
|
|
],
|
|
|
|
'options.supplieraccnum'=>[
|
|
|
|
'request'=>'options.supplieraccnum',
|
|
|
|
'key'=>'order_info.supplieraccnum',
|
|
|
|
'validation'=>'required_with:options.phonenumber',
|
|
|
|
'validation_message'=>'Phone Supplier Account Number is a required field.',
|
|
|
|
],
|
|
|
|
'options.notes'=>[
|
|
|
|
'request'=>'options.notes',
|
|
|
|
'key'=>'order_info.notes',
|
|
|
|
'validation'=>'required_if:options.phonenumber,null',
|
|
|
|
'validation_message'=>'Special Instructions here.',
|
|
|
|
],
|
|
|
|
];
|
|
|
|
|
2022-02-01 05:40:46 +00:00
|
|
|
// The model that is referenced when this product is ordered
|
|
|
|
protected string $order_model = ServiceVoip::class;
|
|
|
|
|
|
|
|
/* RELATIONS */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The offering supplied with this product
|
|
|
|
*
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
|
|
|
*/
|
|
|
|
public function supplied()
|
|
|
|
{
|
|
|
|
return $this->hasOne(SupplierVoip::class,'id','supplier_voip_id');
|
|
|
|
}
|
|
|
|
|
|
|
|
/* INTERFACES */
|
2021-12-24 01:14:01 +00:00
|
|
|
|
|
|
|
public function getContractTermAttribute(): int
|
|
|
|
{
|
|
|
|
return 12;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTypeAttribute()
|
|
|
|
{
|
|
|
|
return 'VOIP';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function hasUsage(): bool
|
|
|
|
{
|
2022-03-05 02:49:50 +00:00
|
|
|
return FALSE;
|
2021-12-24 01:14:01 +00:00
|
|
|
}
|
2022-02-01 05:40:46 +00:00
|
|
|
|
|
|
|
public function allowance(): Collection
|
|
|
|
{
|
|
|
|
// TODO: Implement allowance() method.
|
|
|
|
}
|
|
|
|
|
|
|
|
public function allowance_string(): string
|
|
|
|
{
|
2022-03-05 02:49:50 +00:00
|
|
|
return "(TBA)";
|
2022-02-01 05:40:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getCostAttribute(): float
|
|
|
|
{
|
|
|
|
// TODO: Implement getCostAttribute() method.
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getSupplierAttribute()
|
|
|
|
{
|
|
|
|
// TODO: Implement getSupplierAttribute() method.
|
|
|
|
}
|
2019-07-02 05:28:27 +00:00
|
|
|
}
|