| Total Complexity | 9 |
| Total Lines | 57 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class InvoiceDetail extends Model |
||
| 13 | { |
||
| 14 | use SoftDeletes; |
||
| 15 | use LogsActivity; |
||
| 16 | |||
| 17 | protected $guarded = ['id']; |
||
| 18 | |||
| 19 | protected static bool $logUnguarded = true; |
||
| 20 | |||
| 21 | protected $appends = ['price_with_currency']; |
||
| 22 | |||
| 23 | public function invoice() |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Get the parent invoiceable model |
||
| 30 | */ |
||
| 31 | public function product() |
||
| 32 | { |
||
| 33 | return $this->morphTo(); |
||
| 34 | } |
||
| 35 | |||
| 36 | public function getPriceAttribute($value) |
||
| 37 | { |
||
| 38 | return $value / 100; |
||
| 39 | } |
||
| 40 | |||
| 41 | public function getFinalPriceAttribute($value) |
||
| 42 | { |
||
| 43 | return $value ? $value / 100 : $this->price; |
||
| 44 | } |
||
| 45 | |||
| 46 | public function getTotalPriceAttribute($value) |
||
| 47 | { |
||
| 48 | return ($value * $this->quantity) / 100; |
||
| 49 | } |
||
| 50 | |||
| 51 | public function getPriceWithCurrencyAttribute() |
||
| 58 | } |
||
| 59 | |||
| 60 | /* |
||
| 61 | |-------------------------------------------------------------------------- |
||
| 62 | | MUTATORS |
||
| 63 | |-------------------------------------------------------------------------- |
||
| 64 | */ |
||
| 65 | |||
| 66 | public function setPriceAttribute($value) |
||
| 69 | } |
||
| 70 | } |
||
| 71 |