You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
namespace App\Models;
use Jenssegers\Model\Model;
class Ec2Usage extends Model
{
public string $account;
public string $name;
public string $id;
public string $type;
public float $onDemandCostPerHour;
public float $onDemandCostPerYear;
public float $oneYearReserveCostUpFront;
public float $oneYearReserveCostPerHour;
public float $oneYearReserveCostPerYear; // includes upfront
public float $cpuMin;
public float $cpuMax;
public float $cpuAvg;
public function getOnDemandCostPerYearAttribute($value)
{
return $this->onDemandCostPerHour * 8760;
}
public function getOneYearReserveCostPerYearAttribute($value)
{
return ($this->oneYearReserveCostPerHour * 8760) + $this->oneYearReserveCostUpFront;
}
}
However when I create the report it does not seem that the accessor is being used:
private function createReport() {
$csvExporter = new Export();
$csvExporter->build(
$this->report,
['account','id','type','onDemandCostPerHour','onDemandCostPerYear','oneYearReserveCostPerYear','cpuMin','cpuMax','cpuAvg']
)->download();
}
The text was updated successfully, but these errors were encountered:
@saularis Yes, if they are explicitly set values. These accessors are setup to return a value based on another value, so in that case they don't seem to work.
I'll do some digging around and see if I can locate the root cause, but not sure if anything comes to mind / this is expected functionality
I have a model based on https://github.com/jenssegers/model, which in my experience, behaves exactly like an eloquent model.
I have a model defined
However when I create the report it does not seem that the accessor is being used:
The text was updated successfully, but these errors were encountered: