public static function checkDbTables() { // database tables installer if (!\Meta\Db::tableExists('db_migrations')) { // import the whole initial databse file \Meta\Db::execute(file_get_contents(abspath('sql/database.sql'))); Flash::success(t('Database imported.')); redirect(page_home()); } }
public function onValidated() { $uid = \User\User::logged()->id; $data = $this->getData(); Db::saveSafe('users', $data); Flash::success(t('Profile saved')); // change password $pass = $data['password_new']; if (strlen($pass) > 0) { Db::update('users', array('password' => md5($pass)), array('id' => $uid)); Flash::success(t('Password changed')); } redirect(url(current_path())); }
public function onAfterSave() { Flash::success(t('Record saved')); redirect(current_path()); }
public function onDelete() { \Meta\Db::delete($this->table, array('id' => $_GET['id'])); \Meta\Flash::success(t('Record deleted')); redirect(current_path()); }