public function deleteAction() { $products = Real::findFirst($this->dispatcher->getParams("id")); $auth = $this->session->get('auth'); $profile = $auth['id']; $get_id = $products->user_id; if ($profile != $get_id) { $this->flash->error("Нет прав удаления!"); $this->view->prof_user = false; } else { $this->view->prof_user = true; $this->view->id = $this->dispatcher->getParams("id"); if ($products->delete() == false) { foreach ($products->getMessages() as $message) { $this->flash->error((string) $message); } } else { $this->flash->success('Данные успешно удалены'); } } }