Option.php
59 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Eloquent model mapping to the WordPress wp_options table. |
| 5 | * Disables timestamps and casts option_value through unserialize for PHP-serialized storage. |
| 6 | * Used by OptionManager for query-based option access beyond get_option. |
| 7 | * |
| 8 | * @package Framework |
| 9 | * @subpackage Wordpress\Models |
| 10 | * @since 1.0.0 |
| 11 | */ |
| 12 | namespace Kirki\Framework\Wordpress\Models; |
| 13 | |
| 14 | \defined('ABSPATH') || exit; |
| 15 | use Kirki\Framework\Database\Query\Model; |
| 16 | class Option extends Model |
| 17 | { |
| 18 | /** |
| 19 | * The timestamps. |
| 20 | * |
| 21 | * @var bool |
| 22 | * |
| 23 | * @since 1.0.0 |
| 24 | */ |
| 25 | protected $timestamps = \false; |
| 26 | /** |
| 27 | * The table. |
| 28 | * |
| 29 | * @var string |
| 30 | * |
| 31 | * @since 1.0.0 |
| 32 | */ |
| 33 | protected $table = 'options'; |
| 34 | /** |
| 35 | * The primary key. |
| 36 | * |
| 37 | * @var string |
| 38 | * |
| 39 | * @since 1.0.0 |
| 40 | */ |
| 41 | protected $primary_key = 'option_id'; |
| 42 | /** |
| 43 | * The casts. |
| 44 | * |
| 45 | * @var string |
| 46 | * |
| 47 | * @since 1.0.0 |
| 48 | */ |
| 49 | protected $casts = ['option_id' => 'integer', 'option_name' => 'string', 'option_value' => 'unserialize']; |
| 50 | /** |
| 51 | * The fillable. |
| 52 | * |
| 53 | * @var string |
| 54 | * |
| 55 | * @since 1.0.0 |
| 56 | */ |
| 57 | protected $fillable = ['option_name', 'option_value', 'autoload']; |
| 58 | } |
| 59 |