1 | <?php namespace Rocket\Entities; |
||
17 | abstract class Field extends Model |
||
18 | { |
||
19 | /** |
||
20 | * {@inheritdoc} |
||
21 | */ |
||
22 | 90 | public function toArray() |
|
26 | |||
27 | /** |
||
28 | * Get the revisions for this class |
||
29 | * |
||
30 | * @codeCoverageIgnore |
||
31 | */ |
||
32 | public function revision() |
||
36 | |||
37 | /** |
||
38 | * Validate and set the value |
||
39 | * |
||
40 | * @param mixed $value |
||
41 | */ |
||
42 | 231 | public function setValueAttribute($value) |
|
50 | |||
51 | /** |
||
52 | * Prepare the value to be stored. |
||
53 | * |
||
54 | * Particularly useful for dates or very special fields |
||
55 | * |
||
56 | * @param mixed $value The value to prepare |
||
57 | * @return mixed |
||
58 | */ |
||
59 | 165 | protected function prepareValue($value) |
|
63 | |||
64 | /** |
||
65 | * Checks if a field is valid |
||
66 | * |
||
67 | * @param mixed $value The value to validate |
||
68 | * @return bool |
||
69 | */ |
||
70 | abstract protected function isValid($value); |
||
71 | } |
||
72 |