| 1 | <?php |
||
| 15 | class Datetime extends Field |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @var string The table associated with the model. |
||
| 19 | */ |
||
| 20 | public $table = 'field_datetime'; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var array The attributes that should be cast to native types. |
||
| 24 | */ |
||
| 25 | protected $casts = [ |
||
| 26 | 'value' => 'datetime', |
||
| 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) |
|
| 39 | |||
| 40 | /** |
||
| 41 | * Convert the model instance to an array. |
||
| 42 | * |
||
| 43 | * @return array |
||
| 44 | */ |
||
| 45 | 3 | public function toArray() |
|
| 49 | |||
| 50 | /** |
||
| 51 | * Checks if a field is valid |
||
| 52 | * |
||
| 53 | * @param mixed $value The value to validate |
||
| 54 | * @return bool |
||
| 55 | */ |
||
| 56 | 12 | protected function isValid($value) |
|
| 66 | } |
||
| 67 |