hasOne(AdslSupplierPlan::class,'id','adsl_supplier_plan_id'); } public function __get($key) { switch($key) { case 'base_down_peak': return $this->attributes['base_down_peak']/$this->attributes['metric']; case 'base_down_peak': return $this->attributes['base_down_offpeak']/$this->attributes['metric']; case 'speed': return $this->product->speed; } // If we dont have a specific key, we'll resolve it normally return parent::__get($key); } }