public function validator_unique($name, $parameter) { $data = $this->model->getWithField($name, $this->model->escape($this->data[$name])); if (count($data) == 0 || $this->model->datastore->checkTemp($name, $this->data[$name])) { return true; } else { return "The value of the %field_name% field must be unique."; } }
/** * Delete a particular item from the model. * @param $params * @return unknown_type */ public function delete($params) { if (User::getPermission($this->permissionPrefix . "_can_delete")) { $data = $this->model->getWithField($this->model->getKeyField(), $params[0]); $this->model->delete($this->model->getKeyField(), $params[0]); User::log("Deleted " . $this->model->name, $data[0]); Application::redirect("{$this->urlPath}?notification=Successfully+deleted+" . strtolower($this->label)); } }
/** * Delete a particular item from the model. * @param $params * @return unknown_type */ public function delete($params) { if (User::getPermission($this->permissionPrefix . "_can_delete")) { $data = $this->model->getWithField($this->model->getKeyField(), $params[0]); $this->model->delete($this->model->getKeyField(), $params[0]); $this->model->setData($data[0]); Application::queueNotification($this->getDeleteNotificationMessage(Utils::singular($this->model->getEntity()), $this->model)); Application::redirect($this->urlPath); } }