model = new Post(); } #[NoReturn] public function actionView($id): void { $model = $this->model->where("id", $id)->first(); $model->load("user"); $res = []; if ($model){ $res = $model->toArray(); } $this->renderApi($res); } #[NoReturn] public function actionDelete($id): void { $model = $this->model->where("id", $id)->first(); $model->load("user"); $res = []; if ($model){ $res = $model->toArray(); } $model->delete(); $this->renderApi($res); } }