| Conditions | 6 |
| Paths | 4 |
| Total Lines | 24 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | public function delete(string $id): ?string |
||
| 30 | { |
||
| 31 | if (!Any::isInt($id) || $id < 1) { |
||
| 32 | throw new NotFoundException(); |
||
| 33 | } |
||
| 34 | |||
| 35 | // get content record and check availability |
||
| 36 | $record = ContentEntity::find($id); |
||
| 37 | if ($record === null) { |
||
| 38 | throw new NotFoundException(); |
||
| 39 | } |
||
| 40 | |||
| 41 | // init delete model |
||
| 42 | $model = new FormContentDelete($record); |
||
| 43 | if ($model->send() && $model->validate()) { |
||
| 44 | $model->make(); |
||
| 45 | App::$Session->getFlashBag()->add('success', __('Content is successful moved to trash')); |
||
| 46 | $this->response->redirect('content/index'); |
||
| 47 | } |
||
| 48 | |||
| 49 | return $this->view->render('content_delete', [ |
||
| 50 | 'model' => $model |
||
| 51 | ]); |
||
| 52 | } |
||
| 53 | } |
||
| 54 |