<?php

namespace App\Modules\Sys\Models;

use Illuminate\Database\Eloquent\Model;

class SysConfig extends Model
{
    protected  $table = 'sys_configs';
    protected $fillable = ['name','value','desc'];

    static function getValueByName($name)
    {
        $record = SysConfig::where('name',$name)->first();
        return isset($record->value) ? $record->value : '';
    }

    static function setValueByName($name,$value)
    {
        return SysConfig::updateOrCreate(compact('name'),compact('value'));
    }
}
