Skip to content

Commit b5109e1

Browse files
committed
wip
1 parent 4f2fd23 commit b5109e1

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

fields.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,47 @@ $field = Checkbox::make(__('Categories'), 'categories')
186186

187187
### Color
188188

189+
The `Color` field is typically a handler for `color` model attributes:
190+
191+
```php
192+
$field = Color::make(__('Background Color'), 'bg_color');
193+
```
194+
195+
> You may use the `hex_color` validation rule for this field. By default no rules attached.
196+
189197
### Date
190198

199+
The `Date` field is typically a handler for `date` or `datetime` model attributes:
200+
201+
```php
202+
$field = Date::make(__('Expires at'), 'expires_at');
203+
```
204+
205+
> You may use the `date` validation rule for this field. By default no rules attached.
206+
207+
You can also apply modifiers on a `Date` field:
208+
209+
```php
210+
// Adds/removes a time handler for the field
211+
$field->withTime();
212+
$field->withTime(false);
213+
214+
// Sets the displayed timezone for the input
215+
// Note, the value is saved to the database in the app's timezone (normally UTC)
216+
$field->timezone('Europe/Budapest');
217+
218+
// Adds the "step" HTML input attribute
219+
$field->step(1);
220+
221+
// Adds the "min" HTML input attribute
222+
$field->min('2024-01-01');
223+
$field->min(now()->addDays(7));
224+
225+
// Adds the "max" HTML input attribute
226+
$field->max('2024-01-01');
227+
$field->max(now()->addDays(7));
228+
```
229+
191230
### Editor
192231

193232
### File

0 commit comments

Comments
 (0)