More works on products

This commit is contained in:
Deon George
2022-02-01 16:40:46 +11:00
parent 1e9f15b40f
commit b9b4416737
36 changed files with 952 additions and 312 deletions

View File

@@ -2,16 +2,15 @@
namespace App\Models\Product;
use App\Models\Base\ProductType;
use App\Traits\NextKey;
use App\Traits\OrderServiceOptions;
use Illuminate\Support\Collection;
class Voip extends ProductType
use App\Interfaces\ProductItem;
use App\Models\Service\Voip as ServiceVoip;
use App\Models\Supplier\Voip as SupplierVoip;
final class Voip extends Type implements ProductItem
{
use NextKey;
const RECORD_ID = '';
use OrderServiceOptions;
protected $table = 'product_voip';
protected $order_attributes = [
'options.phonenumber'=>[
@@ -40,7 +39,22 @@ class Voip extends ProductType
],
];
protected $order_model = \App\Models\Service\Voip::class;
// 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 */
public function getContractTermAttribute(): int
{
@@ -56,4 +70,24 @@ class Voip extends ProductType
{
return TRUE;
}
public function allowance(): Collection
{
// TODO: Implement allowance() method.
}
public function allowance_string(): string
{
// TODO: Implement allowance_string() method.
}
public function getCostAttribute(): float
{
// TODO: Implement getCostAttribute() method.
}
public function getSupplierAttribute()
{
// TODO: Implement getSupplierAttribute() method.
}
}