| Conditions | 2 |
| Paths | 1 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | public function update($id) |
||
| 14 | { |
||
| 15 | return $this->respondWithItem($this->model, function ($model) use ($id) { |
||
| 16 | $item = $model->findOrFail($id); |
||
| 17 | |||
| 18 | if ($this->shouldAuthorize) { |
||
| 19 | $this->authorize('update', $item); |
||
| 20 | } |
||
| 21 | |||
| 22 | $item->fill(request()->all()); |
||
| 23 | $item->save(); |
||
| 24 | return $item; |
||
| 25 | }); |
||
| 26 | } |
||
| 27 | } |
||
| 28 |
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: