Changeset View
Changeset View
Standalone View
Standalone View
src/app/Plan.php
Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | class Plan extends Model | ||||
/** @var array<int, string> Translatable properties */ | /** @var array<int, string> Translatable properties */ | ||||
public $translatable = [ | public $translatable = [ | ||||
'name', | 'name', | ||||
'description', | 'description', | ||||
]; | ]; | ||||
/** | /** | ||||
* The list price for this package at the minimum configuration. | * The list price for this plan at the minimum configuration. | ||||
* | * | ||||
* @return int The costs in cents. | * @return int The costs in cents. | ||||
*/ | */ | ||||
public function cost() | public function cost(): int | ||||
{ | { | ||||
$costs = 0; | $costs = 0; | ||||
// TODO: What about plan's discount_qty/discount_rate? | |||||
mollekopf: I don't think we want the discount to apply here currently, so I would remove the comment… | |||||
foreach ($this->packages as $package) { | foreach ($this->packages as $package) { | ||||
$costs += $package->pivot->cost(); | $costs += $package->pivot->cost(); | ||||
} | } | ||||
return $costs; | // TODO: What about plan's free_months? | ||||
return $costs * $this->months; | |||||
Not Done Inline ActionsI don't think free months should have any effect here. This is about the cost per period of the plan. mollekopf: I don't think free months should have any effect here. This is about the cost per period of the… | |||||
} | } | ||||
/** | /** | ||||
* The relationship to packages. | * The relationship to packages. | ||||
* | * | ||||
* The plan contains one or more packages. Each package may have its minimum number (for | * The plan contains one or more packages. Each package may have its minimum number (for | ||||
* billing) or its maximum (to allow topping out "enterprise" customers on a "small business" | * billing) or its maximum (to allow topping out "enterprise" customers on a "small business" | ||||
* plan). | * plan). | ||||
Show All 32 Lines |
I don't think we want the discount to apply here currently, so I would remove the comment unless you have something specific in mind that we need to take care of.