More product cleanup

This commit is contained in:
2023-05-05 22:05:42 +10:00
parent dc74a064ba
commit 691180b3f0
7 changed files with 109 additions and 87 deletions

View File

@@ -6,11 +6,11 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Arr;
use App\Models\Product;
use App\Traits\{OrderServiceOptions,SiteID};
use App\Traits\{OrderServiceOptions,ProductDetails,SiteID};
abstract class Type extends Model
{
use SiteID,OrderServiceOptions;
use SiteID,ProductDetails,OrderServiceOptions;
/* RELATIONS */
@@ -36,6 +36,16 @@ abstract class Type extends Model
/* ATTRIBUTES */
/**
* The Billing interval that the supplier normally uses for this offering
*
* @return int
*/
public function getBillingIntervalAttribute(): int
{
return static::DefaultBill;
}
/**
* The product contract term is the highest of our defined contract_term (in Products/*) vs the suppliers
* contract term (defined in Supplier/*).
@@ -46,11 +56,4 @@ abstract class Type extends Model
{
return max(Arr::get($this->attributes,'contract_term',0),$this->supplied->contract_term);
}
/* METHODs */
final public function normalizeBillingInterval(): int
{
return static::DefaultBill;
}
}