| 1 | <?php |
||
| 15 | class Date extends Field |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @var string The table associated with the model. |
||
| 19 | */ |
||
| 20 | public $table = 'field_date'; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var array The attributes that should be cast to native types. |
||
| 24 | */ |
||
| 25 | protected $casts = [ |
||
| 26 | 'value' => 'date', |
||
| 27 | ]; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Prepare the value to be stored. |
||
| 31 | * |
||
| 32 | * @param mixed $value The value to prepare |
||
| 33 | * @return string |
||
| 34 | */ |
||
| 35 | 9 | protected function prepareValue($value) |
|
| 41 | |||
| 42 | /** |
||
| 43 | * Convert the model instance to an array. |
||
| 44 | * |
||
| 45 | * @return array |
||
| 46 | */ |
||
| 47 | 3 | public function toArray() |
|
| 51 | |||
| 52 | /** |
||
| 53 | * Checks if a field is valid |
||
| 54 | * |
||
| 55 | * @param mixed $value The value to validate |
||
| 56 | * @return bool |
||
| 57 | */ |
||
| 58 | 15 | protected function isValid($value) |
|
| 68 | } |
||
| 69 |