foreveralone

foreveralone Git Source Tree


Root/web/application/models/settings.php

<?php

namespace application\models;

use system\engine\HF_Model;

class Settings extends HF_Model
{
    public $setting;
    public $value;

    public static function getSetting($key) {
        $setting = \application\models\Settings::getByField("setting", $key);
        if ($setting) {
            return $setting[0]->value;
        } else {
            return null;
        }
    }

    public static function setSetting($key, $val) {
        $setting = \application\models\Settings::getByField("setting", $key);
        if (!$setting) {
            $setting = new \application\models\Settings();
            $setting->setting = $key;
        } else {
            $setting = $setting[0];
        }
        $setting->value = $val;
        $setting->save();
    }
}

Archive Download this file

Branches

Tags

Number of commits:
Page rendered in 0.07418s using 11 queries.