1 | <?php namespace Arcanesoft\Settings\Models; |
||
20 | class Setting extends Model |
||
21 | { |
||
22 | /* ------------------------------------------------------------------------------------------------ |
||
23 | | Properties |
||
24 | | ------------------------------------------------------------------------------------------------ |
||
25 | */ |
||
26 | /** |
||
27 | * The attributes that are mass assignable. |
||
28 | * |
||
29 | * @var array |
||
30 | */ |
||
31 | protected $fillable = ['domain', 'key', 'value']; |
||
32 | |||
33 | /* ------------------------------------------------------------------------------------------------ |
||
34 | | Constructor |
||
35 | | ------------------------------------------------------------------------------------------------ |
||
36 | */ |
||
37 | /** |
||
38 | * {@inheritdoc} |
||
39 | */ |
||
40 | 30 | public function __construct(array $attributes = []) |
|
49 | |||
50 | /* ------------------------------------------------------------------------------------------------ |
||
51 | | Getters & Setters |
||
52 | | ------------------------------------------------------------------------------------------------ |
||
53 | */ |
||
54 | /** |
||
55 | * {@inheritdoc} |
||
56 | */ |
||
57 | 18 | protected function getCastType($key) |
|
61 | |||
62 | /** |
||
63 | * Set the type attributes. |
||
64 | * |
||
65 | * @param string $type |
||
66 | */ |
||
67 | 18 | public function setTypeAttribute($type) |
|
72 | |||
73 | 18 | public function getCastedValueAttribute() |
|
79 | |||
80 | /* ------------------------------------------------------------------------------------------------ |
||
81 | | CRUD Functions |
||
82 | | ------------------------------------------------------------------------------------------------ |
||
83 | */ |
||
84 | /** |
||
85 | * Create a setting. |
||
86 | * |
||
87 | * @param string $domain |
||
88 | * @param string $key |
||
89 | * @param mixed $value |
||
90 | * |
||
91 | * @return bool |
||
92 | */ |
||
93 | 18 | public function createOne($domain, $key, $value) |
|
103 | |||
104 | /** |
||
105 | * Update the setting value. |
||
106 | * |
||
107 | * @param mixed $value |
||
108 | */ |
||
109 | 18 | public function updateValue($value) |
|
114 | } |
||
115 |