36 lines
754 B
PHP
36 lines
754 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Models\Product;
|
||
|
|
||
|
use App\Traits\NextKey;
|
||
|
use App\Models\AdslSupplierPlan;
|
||
|
|
||
|
class Adsl extends \App\Models\Base\ProductType
|
||
|
{
|
||
|
use NextKey;
|
||
|
|
||
|
const RECORD_ID = 'adsl_plan';
|
||
|
|
||
|
protected $table = 'ab_adsl_plan';
|
||
|
|
||
|
public function product()
|
||
|
{
|
||
|
return $this->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);
|
||
|
}
|
||
|
}
|