public function actionNew() { $post = $this->app->request->post; if ($post->count()) { try { $consignment = new Model(); $consignment->fill($post); $consignment->save(); $this->app->flash->success = 'Запись #' . $consignment->__id . ' успешно добавлена'; $this->redirect('/consignment/index'); } catch (\Exception $e) { $this->data->error = $e->getMessage(); } } $this->data->paints = Paint::findAll(); }