| Conditions | 3 |
| Paths | 3 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | 4 | public function handleHistory(Request $request, $id) |
|
| 24 | { |
||
| 25 | 4 | $this->beforeInit(); |
|
| 26 | 4 | $this->init(); |
|
| 27 | 4 | $this->bound(); |
|
| 28 | |||
| 29 | 4 | if (!$this->can('history')) { |
|
| 30 | 2 | throw UnauthorizedException::forPermissions(['history']); |
|
| 31 | } |
||
| 32 | |||
| 33 | 2 | $model = $this->crud()->repo()->find($id); |
|
| 34 | 2 | if (!$this->crud()->actions()->isAllowed('history', $model)) { |
|
| 35 | 1 | throw new PermissionDenied(); |
|
| 36 | } |
||
| 37 | |||
| 38 | 1 | return view($this->historyCrudHistory, [ |
|
| 39 | 1 | 'crud' => $this->crud(), |
|
| 40 | 1 | 'item' => $model, |
|
| 41 | 1 | 'versions' => $model->versions()->latest()->paginate(8), |
|
| 42 | ]); |
||
| 43 | } |
||
| 44 | |||
| 51 |
For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a
@returndoc comment to communicate to implementors of these methods what they are expected to return.