| 1 | <?php namespace Bedard\Shop\Traits; |
||
| 3 | trait Amountable |
||
| 4 | { |
||
| 5 | /** |
||
| 6 | * Boot the amountable trait for this model. |
||
| 7 | * |
||
| 8 | * @return void |
||
| 9 | */ |
||
| 10 | public static function bootAmountable() |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Get the exact amount. |
||
| 38 | * |
||
| 39 | * @return float |
||
| 40 | */ |
||
| 41 | public function getAmountExactAttribute() |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Get the percentage amount. |
||
| 48 | * |
||
| 49 | * @return float |
||
| 50 | */ |
||
| 51 | public function getAmountPercentageAttribute() |
||
| 55 | |||
| 56 | /** |
||
| 57 | * Set the promotion amount. |
||
| 58 | * |
||
| 59 | * @return void |
||
| 60 | */ |
||
| 61 | public function setAmount() |
||
| 70 | } |
||
| 71 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: