You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

31 lines
660 B

<?php
namespace App\Services;
use App\CommonSettings;
class CommonSettingService
{
public function addSettings(string $key, string $value)
{
$setting = new CommonSettings();
$setting->key = $key;
$setting->value = $value;
$setting->version = 1;
$setting->save();
}
public function queryByKey(string $key)
{
return CommonSettings::where("key", $key)->get();
}
public function updateValue(string $key, string $value, int $version)
{
return CommonSettings::where("key", $key)
->where("version", $version)
->update(["value" => $value]);
}
}