1 | <?php |
||
23 | abstract class Field extends Model |
||
24 | { |
||
25 | /** |
||
26 | * Convert the model instance to an array. |
||
27 | * |
||
28 | * @return array |
||
29 | */ |
||
30 | 90 | public function toArray() |
|
34 | |||
35 | /** |
||
36 | * Get the revisions for this class |
||
37 | * |
||
38 | * @codeCoverageIgnore |
||
39 | */ |
||
40 | public function revision() |
||
44 | |||
45 | /** |
||
46 | * Validate and set the value |
||
47 | * |
||
48 | * @param mixed $value |
||
49 | */ |
||
50 | 231 | public function setValueAttribute($value) |
|
58 | |||
59 | /** |
||
60 | * Prepare the value to be stored. |
||
61 | * |
||
62 | * Particularly useful for dates or very special fields |
||
63 | * |
||
64 | * @param mixed $value The value to prepare |
||
65 | * @return mixed |
||
66 | */ |
||
67 | 165 | protected function prepareValue($value) |
|
71 | |||
72 | /** |
||
73 | * Checks if a field is valid |
||
74 | * |
||
75 | * @param mixed $value The value to validate |
||
76 | * @return bool |
||
77 | */ |
||
78 | abstract protected function isValid($value); |
||
79 | } |
||
80 |