| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | public function display(string $id): void |
||
| 26 | { |
||
| 27 | $status = (bool)$this->request->query->get('status', 0); |
||
| 28 | $content = \Apps\ActiveRecord\Content::find($id); |
||
| 29 | if (!$content) { |
||
| 30 | throw new NotFoundException(__('Content {%id%} are not exist', ['id' => $id])); |
||
| 31 | } |
||
| 32 | // make update query if status is different than required |
||
| 33 | if ((bool)$content->display !== $status) { |
||
| 34 | $content->display = $status; |
||
| 35 | $content->save(); |
||
| 36 | } |
||
| 37 | |||
| 38 | $this->response->redirect('content/index'); |
||
| 39 | } |
||
| 41 |