1 | <?php namespace Anomaly\PreferencesModule\Preference; |
||
23 | class PreferenceModel extends PreferencesPreferencesEntryModel implements PreferenceInterface |
||
24 | { |
||
25 | |||
26 | /** |
||
27 | * The cache minutes. |
||
28 | * |
||
29 | * @var int |
||
30 | */ |
||
31 | protected $cacheMinutes = 99999; |
||
32 | |||
33 | /** |
||
34 | * Limit to preferences belonging to the provided user. |
||
35 | * |
||
36 | * @param Builder $query |
||
37 | * @param UserInterface $user |
||
38 | */ |
||
39 | public function scopeBelongingToUser(Builder $query, UserInterface $user) |
||
43 | |||
44 | /** |
||
45 | * Get the key. |
||
46 | * |
||
47 | * @return string |
||
48 | */ |
||
49 | public function getKey() |
||
53 | |||
54 | /** |
||
55 | * Set the key. |
||
56 | * |
||
57 | * @param $key |
||
58 | * @return $this |
||
59 | */ |
||
60 | public function setKey($key) |
||
61 | { |
||
62 | $this->key = $key; |
||
63 | |||
64 | return $this; |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * Get the user. |
||
69 | * |
||
70 | * @return UserInterface |
||
71 | */ |
||
72 | public function getUser() |
||
76 | |||
77 | /** |
||
78 | * Set the user. |
||
79 | * |
||
80 | * @param UserInterface $user |
||
81 | * @return $this |
||
82 | */ |
||
83 | public function setUser(UserInterface $user) |
||
84 | { |
||
85 | $this->user = $user; |
||
86 | |||
87 | return $this; |
||
88 | } |
||
89 | |||
90 | /** |
||
91 | * Get the value. |
||
92 | * |
||
93 | * @return mixed |
||
94 | */ |
||
95 | public function getValue() |
||
99 | |||
100 | /** |
||
101 | * Set the value. |
||
102 | * |
||
103 | * @param $value |
||
104 | * @return $this |
||
105 | */ |
||
106 | public function setValue($value) |
||
112 | |||
113 | /** |
||
114 | * Set the value. |
||
115 | * |
||
116 | * @param $value |
||
117 | * @return $this |
||
118 | */ |
||
119 | protected function setValueAttribute($value) |
||
125 | |||
126 | /** |
||
127 | * Get the value attribute. |
||
128 | * |
||
129 | * @return mixed |
||
130 | */ |
||
131 | protected function getValueAttribute() |
||
142 | |||
143 | /** |
||
144 | * Get the field type's presenter |
||
145 | * for a given field slug. |
||
146 | * |
||
147 | * We're overriding this to catch |
||
148 | * the "value" key. |
||
149 | * |
||
150 | * @param $fieldSlug |
||
151 | * @return FieldTypePresenter |
||
152 | */ |
||
153 | public function getFieldTypePresenter($fieldSlug) |
||
161 | } |
||
162 |