Cleanup usage of Leenooks\Carbon, change ServiceType to be consistent with Products/ Suppliers/

This commit is contained in:
Deon George
2022-04-22 11:47:46 +10:00
parent 8ed9e38290
commit a16277d9bb
19 changed files with 65 additions and 64 deletions

View File

@@ -6,11 +6,9 @@ use Illuminate\Support\Collection;
use Leenooks\Traits\ScopeActive;
use App\Interfaces\ProductItem;
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;
@@ -61,7 +59,7 @@ final class Broadband extends Type implements ProductItem
{
$config = collect();
foreach (array_keys(Supplier\Broadband::traffic_map) as $k => $v) {
foreach (array_keys(SupplierBroadband::traffic_map) as $k => $v) {
// Base Config
$config->put($k,$this->{$k});
// Excess Config
@@ -90,7 +88,7 @@ final class Broadband extends Type implements ProductItem
{
$result = 0;
foreach ($this->supplied->allowance(NULL,$this->allowance([])->toArray()) as $k=>$v) {
$result += -$v*$this->supplied->{Supplier\Broadband::traffic_map[$k]};
$result += -$v*$this->supplied->{SupplierBroadband::traffic_map[$k]};
}
return $result;