24 lines
443 B
PHP
24 lines
443 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Settings extends Model
|
|
{
|
|
protected $fillable = [
|
|
'key',
|
|
'value'
|
|
];
|
|
|
|
public static function get($key, $default = null)
|
|
{
|
|
return static::where('key', $key)->value('value') ?? $default;
|
|
}
|
|
|
|
public static function set($key, $value)
|
|
{
|
|
return static::updateOrCreate(['key' => $key], ['value' => $value]);
|
|
}
|
|
}
|