Start work on updating services
This commit is contained in:
@@ -10,6 +10,7 @@ use App\Models\Supplier;
|
||||
use App\Models\Service\Broadband as ServiceBroadband;
|
||||
use App\Models\Supplier\Broadband as SupplierBroadband;
|
||||
|
||||
// @todo does this need to extend Type? Perhaps have a ProductType consistent with ServiceType.
|
||||
final class Broadband extends Type implements ProductItem
|
||||
{
|
||||
use ScopeActive;
|
||||
@@ -44,7 +45,7 @@ final class Broadband extends Type implements ProductItem
|
||||
*/
|
||||
public function supplied()
|
||||
{
|
||||
return $this->hasOne(SupplierBroadband::class,'id','supplier_broadband_id');
|
||||
return $this->hasOne(SupplierBroadband::class,'id','supplier_item_id');
|
||||
}
|
||||
|
||||
/* INTERFACES */
|
||||
|
@@ -24,7 +24,7 @@ final class Domain extends Type implements ProductItem
|
||||
*/
|
||||
public function supplied()
|
||||
{
|
||||
return $this->hasOne(SupplierDomain::class,'id','supplier_domain_id');
|
||||
return $this->hasOne(SupplierDomain::class,'id','supplier_item_id');
|
||||
}
|
||||
|
||||
/* INTERFACES */
|
||||
|
@@ -24,7 +24,7 @@ final class Email extends Type implements ProductItem
|
||||
*/
|
||||
public function supplied()
|
||||
{
|
||||
return $this->hasOne(SupplierEmail::class,'id','supplier_email_id');
|
||||
return $this->hasOne(SupplierEmail::class,'id','supplier_item_id');
|
||||
}
|
||||
|
||||
/* INTERFACES */
|
||||
|
@@ -24,7 +24,7 @@ final class Generic extends Type implements ProductItem
|
||||
*/
|
||||
public function supplied()
|
||||
{
|
||||
return $this->hasOne(SupplierGeneric::class,'id','supplier_generic_id');
|
||||
return $this->hasOne(SupplierGeneric::class,'id','supplier_item_id');
|
||||
}
|
||||
|
||||
/* INTERFACES */
|
||||
|
@@ -24,7 +24,7 @@ final class Host extends Type implements ProductItem
|
||||
*/
|
||||
public function supplied()
|
||||
{
|
||||
return $this->hasOne(SupplierHost::class,'id','supplier_host_id');
|
||||
return $this->hasOne(SupplierHost::class,'id','supplier_item_id');
|
||||
}
|
||||
|
||||
/* INTERFACES */
|
||||
|
@@ -5,18 +5,18 @@ namespace App\Models\Product;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
use App\Interfaces\ProductItem;
|
||||
use App\Models\Service\Voip as ServiceVoip;
|
||||
use App\Models\Supplier\Voip as SupplierVoip;
|
||||
use App\Models\Service\Phone as ServicePhone;
|
||||
use App\Models\Supplier\Phone as SupplierPhone;
|
||||
|
||||
final class Voip extends Type implements ProductItem
|
||||
final class Phone extends Type implements ProductItem
|
||||
{
|
||||
protected $table = 'product_voip';
|
||||
protected $table = 'product_phone';
|
||||
|
||||
protected array $order_attributes = [
|
||||
'options.phonenumber'=>[
|
||||
'request'=>'options.phonenumber',
|
||||
'key'=>'service_number',
|
||||
'validation'=>'nullable|size:10|unique:ab_service__voip,service_number',
|
||||
'validation'=>'nullable|size:10|unique:service_phone,service_number',
|
||||
'validation_message'=>'Phone Number is a required field.',
|
||||
],
|
||||
'options.supplier'=>[
|
||||
@@ -40,7 +40,7 @@ final class Voip extends Type implements ProductItem
|
||||
];
|
||||
|
||||
// The model that is referenced when this product is ordered
|
||||
protected string $order_model = ServiceVoip::class;
|
||||
protected string $order_model = ServicePhone::class;
|
||||
|
||||
/* RELATIONS */
|
||||
|
||||
@@ -51,19 +51,20 @@ final class Voip extends Type implements ProductItem
|
||||
*/
|
||||
public function supplied()
|
||||
{
|
||||
return $this->hasOne(SupplierVoip::class,'id','supplier_voip_id');
|
||||
return $this->hasOne(SupplierPhone::class,'id','supplier_item_id');
|
||||
}
|
||||
|
||||
/* INTERFACES */
|
||||
|
||||
public function getContractTermAttribute(): int
|
||||
{
|
||||
// @todo Get this from the DB
|
||||
return 12;
|
||||
}
|
||||
|
||||
public function getTypeAttribute()
|
||||
{
|
||||
return 'VOIP';
|
||||
return 'PHONE';
|
||||
}
|
||||
|
||||
public function hasUsage(): bool
|
@@ -24,7 +24,7 @@ final class SSL extends Type implements ProductItem
|
||||
*/
|
||||
public function supplied()
|
||||
{
|
||||
return $this->hasOne(SupplierSSL::class,'id','supplier_ssl_id');
|
||||
return $this->hasOne(SupplierSSL::class,'id','supplier_item_id');
|
||||
}
|
||||
|
||||
/* INTERFACES */
|
||||
@@ -52,19 +52,9 @@ final class SSL extends Type implements ProductItem
|
||||
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()
|
||||
{
|
||||
abort(500,'deprecated');
|
||||
$o = new \stdClass();
|
||||
$o->name = 'Internal';
|
||||
|
||||
|
@@ -7,6 +7,10 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Product;
|
||||
use App\Traits\{OrderServiceOptions,SiteID};
|
||||
|
||||
/**
|
||||
* @todo These tables have a base_cost/setup_cost/contract_term columns - how is that different to the supplier_tables?
|
||||
* @todo Ensure our terminology is consistent - we have a "cost", we "charge" clients.
|
||||
*/
|
||||
abstract class Type extends Model
|
||||
{
|
||||
use SiteID,OrderServiceOptions;
|
||||
|
Reference in New Issue
Block a user