| 1 | <?php |
||
| 9 | trait HashidsTrait |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * Get the value of the model's route key. |
||
| 13 | * |
||
| 14 | * @throws \Exception |
||
| 15 | * |
||
| 16 | * @return mixed |
||
| 17 | */ |
||
| 18 | public function getRouteKey() |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Retrieve the model for a bound value. |
||
| 29 | * |
||
| 30 | * @param mixed $value |
||
| 31 | * @param string|null $field |
||
| 32 | * |
||
| 33 | * @return \Illuminate\Database\Eloquent\Model|null |
||
| 34 | */ |
||
| 35 | public function resolveRouteBinding($value, $field = null) |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Unhash given value of the model. |
||
| 46 | * |
||
| 47 | * @param mixed $value |
||
| 48 | * |
||
| 49 | * @return mixed |
||
| 50 | */ |
||
| 51 | public function unhashId($value) |
||
| 57 | } |
||
| 58 |
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: