no message
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\ai;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
|
||||
class AiConfig extends BaseModel
|
||||
{
|
||||
public static function getVal(string $name, string $default = ''): string
|
||||
{
|
||||
$val = AiConfig::where('name', $name)->value('value');
|
||||
return $val !== null ? $val : $default;
|
||||
}
|
||||
|
||||
public static function setVal(string $name, string $value): void
|
||||
{
|
||||
$row = AiConfig::where('name', $name)->findOrEmpty();
|
||||
if ($row->isEmpty()) {
|
||||
AiConfig::create(['name' => $name, 'value' => $value]);
|
||||
} else {
|
||||
$row->value = $value;
|
||||
$row->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user