Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
25 | public function important(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 | |||
33 | if ((bool)$content->important !== $status) { |
||
34 | $content->important = $status; |
||
35 | $content->save(); |
||
36 | } |
||
37 | |||
38 | $this->response->redirect('content/index'); |
||
39 | } |
||
40 | } |