public static function update($data) { $author = Author::instance()->findByPK(self::data('id_author'))->get(1); $author->copyfrom('POST', function ($data) { return $data; }); $data['password'] || ($author->password = null); $saved = $author->save(); !$saved || self::login($author->cast(), $author->is_admin); return $saved; }
public function delete($moe) { $moe->send(array('result' => Author::instance()->findByPK($moe->get('GET.id'))->findByNotId_author(Auth::data('id_author'))->get(1)->delete())); }
public function profile($moe, $params) { $this->pageTitle('Profile of ' . $params['username']); $moe->set('profile', Author::instance()->profile($params['username'])); $moe->send('home/profile'); }