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