sakura/app/models/option-model.php

34 lines
644 B
PHP
Raw Normal View History

2021-07-14 14:55:41 +08:00
<?php
namespace Sakura\Models;
class OptionModel extends BaseModel
{
public static $namespace = 'sakura_options';
public static function the_key(string $key)
{
return self::$namespace . "_{$key}";
}
public static function create(string $key, $value)
{
return add_option(self::the_key($key), $value);
}
public static function get(string $key)
{
return get_option(self::the_key($key));
}
public static function update(string $key, $value)
{
return update_option(self::the_key($key), $value);
}
public static function delete(string $key)
{
return delete_option(self::the_key($key));
}
}