/** * Set the unique key for the roles * @Developer brandon * @Date Oct 12, 2010 */ public function unique_key($id = NULL) { if (!empty($id) && is_string($id) && !ctype_digit($id)) { return 'name'; } return parent::unique_key($id); }
/** * Allows finding roles by name. */ public function unique_key($id) { if (!empty($id) and is_string($id) and !ctype_digit($id)) { return 'title'; } return parent::unique_key($id); }
public function delete() { $table_prefix = Kohana::config('database.default.table_prefix'); // Remove assigned users // Have to use db->query() since we don't have an ORM model for roles_users $this->db->query('DELETE FROM ' . $table_prefix . 'roles_users WHERE role_id = ?', $this->id); // Remove assigned permissions // Have to use db->query() since we don't have an ORM model for permissions_roles $this->db->query('DELETE FROM ' . $table_prefix . 'permissions_roles WHERE role_id = ?', $this->id); parent::delete(); }
public function __construct($id = NULL) { parent::__construct($id); $this->title = $this->name; }