| Total Complexity | 5 |
| Total Lines | 62 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class Fee extends Model |
||
| 12 | { |
||
| 13 | use CrudTrait; |
||
|
|
|||
| 14 | |||
| 15 | public $timestamps = false; |
||
| 16 | |||
| 17 | protected $guarded = ['id']; |
||
| 18 | |||
| 19 | protected $appends = ['price_with_currency', 'type']; |
||
| 20 | |||
| 21 | /* |
||
| 22 | |-------------------------------------------------------------------------- |
||
| 23 | | FUNCTIONS |
||
| 24 | |-------------------------------------------------------------------------- |
||
| 25 | */ |
||
| 26 | |||
| 27 | /* |
||
| 28 | |-------------------------------------------------------------------------- |
||
| 29 | | RELATIONS |
||
| 30 | |-------------------------------------------------------------------------- |
||
| 31 | */ |
||
| 32 | |||
| 33 | /* |
||
| 34 | |-------------------------------------------------------------------------- |
||
| 35 | | SCOPES |
||
| 36 | |-------------------------------------------------------------------------- |
||
| 37 | */ |
||
| 38 | |||
| 39 | /* |
||
| 40 | |-------------------------------------------------------------------------- |
||
| 41 | | ACCESORS |
||
| 42 | |-------------------------------------------------------------------------- |
||
| 43 | */ |
||
| 44 | |||
| 45 | public function getPriceAttribute($value) |
||
| 46 | { |
||
| 47 | return $value / 100; |
||
| 48 | } |
||
| 49 | |||
| 50 | public function getPriceWithCurrencyAttribute() |
||
| 51 | { |
||
| 52 | if (config('app.currency_position') === 'before') { |
||
| 53 | return config('app.currency_symbol').' '.$this->price; |
||
| 54 | } |
||
| 55 | |||
| 56 | return $this->price.' '.config('app.currency_symbol'); |
||
| 57 | } |
||
| 58 | |||
| 59 | public function getTypeAttribute() |
||
| 60 | { |
||
| 61 | return 'fee'; |
||
| 62 | } |
||
| 63 | |||
| 64 | /* |
||
| 65 | |-------------------------------------------------------------------------- |
||
| 66 | | MUTATORS |
||
| 67 | |-------------------------------------------------------------------------- |
||
| 68 | */ |
||
| 69 | |||
| 70 | public function setPriceAttribute($value) |
||
| 73 | } |
||
| 74 | } |
||
| 75 |