sakura/app/models/option-model.php
2021-07-15 00:14:48 +08:00

34 lines
643 B
PHP

<?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));
}
}