protected function onPost(\Controllers\Request $input) { $this->data['create_success'] = false; try { $obj = Soil::createFromInput($input); $this->data['create_success'] = true; $this->view = 'admin.soil.edit'; $this->dta['soil_type'] = $obj; return $this->redirect($this->plugin->soil_url('update', ['id' => $obj->id])); } catch (\Exceptions\Validation $ex) { $this->data['errors'] = $ex->validator->errors(); } catch (\Exception $ex) { $this->errors->add('create-error', $ex->getMessage()); } return parent::onPost($input); }