<?php

namespace App\System\Model;
use App\System\Basic\beModel;

class SettingModel extends beModel {
    public $table = "be_settings";
    public $primary_key = "sid";
    public static function beGetSettings($settingcodes){
        $settingcodes = explode(",",$settingcodes);
        $settinglist = self::beSelect("scode,svalue")->beWhere("scode",$settingcodes,"IN")->beGetAll();
        $settings = [];
        foreach($settinglist as $setting){
            $settings[$setting["scode"]] = $setting["svalue"];
        }
        return $settings;
    }
    public static function beUpdateSetting($settingcode,$settingvalue){
        self::beUpdate([
            "svalue" => $settingvalue
        ])->beWhere("scode",$settingcode)->beExecute();
    }
}

?>