| @@ 13-23 (lines=11) @@ | ||
| 10 | * @param int $id |
|
| 11 | * @return \Illuminate\Http\Response |
|
| 12 | */ |
|
| 13 | public function destroy($id) |
|
| 14 | { |
|
| 15 | $item = $this->model->findOrFail($id); |
|
| 16 | ||
| 17 | if ($this->shouldAuthorize) { |
|
| 18 | $this->authorize('delete', $item); |
|
| 19 | } |
|
| 20 | ||
| 21 | $item->delete(); |
|
| 22 | return $this->respondWithNoContent(); |
|
| 23 | } |
|
| 24 | } |
|
| 25 | ||
| @@ 13-24 (lines=12) @@ | ||
| 10 | * @param int $id |
|
| 11 | * @return \Illuminate\Http\Response |
|
| 12 | */ |
|
| 13 | public function show($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('view', $item); |
|
| 20 | } |
|
| 21 | ||
| 22 | return $item; |
|
| 23 | }); |
|
| 24 | } |
|
| 25 | } |
|
| 26 | ||