/** * Constructor * * @param boolean $autoinit */ public function __construct($id = NULL) { parent::__construct('users'); if ($id) { cogear()->db->where('id', $id); $this->find(); } }
/** * Найти все */ public function findAll() { if ($result = parent::findAll()) { foreach ($result as $file) { $file->getInfo(); } } return $result; }
/** * Delete * * @return boolean */ public function delete() { if ($result = parent::delete()) { if ($childs = $this->getChilds()) { foreach ($childs as $child) { $child->delete(); } } } return $result; }
/** * Save page */ public function save() { // Event call event('page.save.before', $this); parent::save(); // Generate hierarchy path $this->genPath(); // Update object data $this->update(); // Event call event('page.save.after', $this); }
/** * */ public function insert($data = NULL) { if ($result = parent::insert($data)) { event('user.insert', $this, $data, $result); } return $result; }
/** * Render post */ public function render($template = NULL) { event('post.render', $this); if (!$this->teaser) { $this->views++; $this->cache(FALSE); $this->update(array('views' => $this->views)); } return parent::render($template); }