More Product Model optimisation

This commit is contained in:
2023-05-05 15:48:24 +10:00
parent 96f799f535
commit 820ff2be00
37 changed files with 161 additions and 592 deletions

View File

@@ -5,20 +5,22 @@ namespace App\Models\Supplier;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use App\Interfaces\SupplierItem;
use App\Models\Product\Broadband as ProductBroadband;
class Broadband extends Type implements SupplierItem
class Broadband extends Type
{
protected const category_name = 'Broadband';
protected $table = 'supplier_broadband';
// The model of the product that is supplied by this model
const ProductModel = ProductBroadband::class;
protected $casts = [
'offpeak_start' => 'datetime:H:i',
'offpeak_end' => 'datetime:H:i',
];
protected $table = 'supplier_broadband';
// Map the table fields, with the extra fields
public const traffic_map = [
'base_up_offpeak' => 'extra_up_offpeak',
@@ -35,22 +37,6 @@ class Broadband extends Type implements SupplierItem
'extra_down_peak' => 'base_down_peak',
];
/* INTERFACES */
/**
* @return int
* @deprecated use Product::normalizeBillingInterval()
*/
public function getBillingIntervalAttribute(): int
{
return 1; // Monthly
}
public function products()
{
return $this->hasMany(ProductBroadband::class,'supplier_item_id','id');
}
/* METHODS */
/**