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,75 +2,56 @@
namespace App\Interfaces;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Support\Collection;
interface ProductItem
{
/* RELATIONS */
public function product();
public function supplied();
/**
* Supplier that provides this offering
* Return the traffic inclusion with the service
*
* @return BelongsTo
* @return mixed
*/
//public function supplier_detail(): BelongsTo;
public function allowance(): Collection;
/**
* Available products created from this supplier offering
* Render the traffic inclusion as a string
*
* @return BelongsToMany
* @return mixed
*/
//public function types(): BelongsToMany;
/* ATTRIBUTES */
public function allowance_string(): string;
/**
* Return the billing interval base cost including tax
* Return the contract term for this product when sold as a service
*
* @return float
*/
public function getBaseCostTaxableAttribute(): float;
/**
* Return the billing interval that the supplier charges
*
* @return string
*/
public function getBillingIntervalAttribute(): int;
/**
* The term that the supplier imposes on this service being connected
*
* @return int
* @return int Months
*/
public function getContractTermAttribute(): int;
/**
* Suppliers offering name (short)
*
* @return string
*/
public function getNameAttribute(): string;
/**
* Suppliers offering name (long)
*
* @return string
*/
public function getNameLongAttribute(): string;
/**
* Return the setup cost including tax
* Return the product cost
*
* @return float
*/
public function getSetupCostTaxableAttribute(): float;
public function getCostAttribute(): float;
/**
* Return the type of offering this is.
* Return the supplier class
* If there is a model relationship return:
* return $this->getRelationValue('supplier');
* otherwise return a stdClass with name
*
* @return string
* @return mixed
*/
public function getTypeAttribute();
public function getSupplierAttribute();
/**
* Does this offering capture usage information
*
* @return bool
*/
public function hasUsage(): bool;
}

View File

@@ -1,56 +0,0 @@
<?php
namespace App\Interfaces;
use Illuminate\Support\Collection;
/**
* @deprecated - rename to productItem if still required
*/
interface ProductSupplier
{
/**
* Return the traffic inclusion with the service
*
* @return mixed
*/
public function allowance(): Collection;
/**
* Render the traffic inclusion as a string
*
* @return mixed
*/
public function allowance_string(): string;
/**
* Return the contract term for this product when sold as a service
*
* @return int Months
*/
public function getContractTermAttribute(): int;
/**
* Return the product cost
*
* @return float
*/
public function getCostAttribute(): float;
/**
* Return the supplier class
* If there is a model relationship return:
* return $this->getRelationValue('supplier');
* otherwise return a stdClass with name
*
* @return mixed
*/
public function getSupplierAttribute();
/**
* Does this offering capture usage information
*
* @return bool
*/
public function hasUsage(): bool;
}

View File

@@ -2,9 +2,6 @@
namespace App\Interfaces;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
interface SupplierItem
{
/* RELATIONS */
@@ -12,16 +9,16 @@ interface SupplierItem
/**
* Supplier that provides this offering
*
* @return BelongsTo
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function supplier_detail(): BelongsTo;
public function supplier_detail();
/**
* Available products created from this supplier offering
*
* @return BelongsToMany
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function types(): BelongsToMany;
public function types();
/* ATTRIBUTES */