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