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() |
||
28 | |||
29 | /** |
||
30 | * Retrieve the model for a bound value. |
||
31 | * |
||
32 | * @param mixed $value |
||
33 | * @param string|null $field |
||
34 | * |
||
35 | * @return \Illuminate\Database\Eloquent\Model|null |
||
36 | */ |
||
37 | public function resolveRouteBinding($value, $field = null) |
||
46 | |||
47 | /** |
||
48 | * Unhash given value of the model. |
||
49 | * |
||
50 | * @param mixed $value |
||
51 | * |
||
52 | * @return mixed |
||
53 | */ |
||
54 | public function unhashId($value) |
||
61 | } |
||
62 |
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: