Files
sirpremiumv2/app/Models/WhatsappSystemConfig.php
T
2026-04-24 21:40:10 -05:00

27 lines
657 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class WhatsappSystemConfig extends Model
{
protected $table = 'whatsapp_system_config';
protected $fillable = ['config_key', 'config_value', 'description'];
public static function get(string $key, string $default = ''): string
{
$record = static::where('config_key', $key)->first();
return $record ? ($record->config_value ?? $default) : $default;
}
public static function set(string $key, string $value): void
{
static::updateOrCreate(
['config_key' => $key],
['config_value' => $value]
);
}
}