Updates to Product Model, product updates, enable pricing update, improved formating of product services
This commit is contained in:
@@ -18,6 +18,7 @@ use Illuminate\Support\Facades\Auth;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Leenooks\Carbon as LeenooksCarbon;
|
||||
|
||||
use App\Models\Product\Type;
|
||||
use App\Models\Scopes\SiteScope;
|
||||
use App\Interfaces\IDs;
|
||||
use App\Traits\ScopeServiceUserAuthorised;
|
||||
@@ -530,6 +531,7 @@ class Service extends Model implements IDs
|
||||
*
|
||||
* @return float
|
||||
* @throws Exception
|
||||
* @deprecated use class::charge_normalized()
|
||||
*/
|
||||
public function getBillingMonthlyPriceAttribute(): float
|
||||
{
|
||||
@@ -809,7 +811,7 @@ class Service extends Model implements IDs
|
||||
*
|
||||
* @return Model
|
||||
*/
|
||||
public function getOfferingAttribute(): Model
|
||||
public function getOfferingAttribute(): Type
|
||||
{
|
||||
return $this->product->type;
|
||||
}
|
||||
@@ -1068,6 +1070,16 @@ class Service extends Model implements IDs
|
||||
return round($value*1.1,2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a normalize price dependent on the product, ie: Broadband = Monthly, Domain = Yearly, etc
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function charge_normalized(): float
|
||||
{
|
||||
return number_format($this->getBillingChargeAttribute()*Invoice::billing_change($this->recur_schedule,$this->offering->normalizeBillingInterval()),2);
|
||||
}
|
||||
|
||||
private function getOrderInfoValue(string $key): ?string
|
||||
{
|
||||
return $this->order_info ? $this->order_info->get($key) : NULL;
|
||||
|
Reference in New Issue
Block a user