Basics
Contains all Basic Methods.
The Date
field is equivalent to <input type="date">
.
use MoonShine\UI\Fields\Date;Date::make('Created at', 'created_at')
use MoonShine\UI\Fields\Date;Date::make('Created at', 'created_at')
<x-moonshine::form.wrapper label="Created at"><x-moonshine::form.inputtype="date"name="created_at"/></x-moonshine::form.wrapper>
<x-moonshine::form.wrapper label="Created at"><x-moonshine::form.inputtype="date"name="created_at"/></x-moonshine::form.wrapper>
Basic Methods
Date and Time
Using the withTime()
method allows you to enter both date and time in the field.
Date::make('Created at', 'created_at')->withTime()
Date::make('Created at', 'created_at')->withTime()
Format
The format()
method allows you to change the display format of the field's value in preview.
format(string $format)
format(string $format)
Date::make('Created at', 'created_at')->format('d.m.Y')
Date::make('Created at', 'created_at')->format('d.m.Y')
Extensions
The field supports various extensions for help and input control.
Copy
The copy()
method adds a button to copy the field's value.
copy(string $value = '{{value}}')
copy(string $value = '{{value}}')
Date::make('Created at', 'created_at')->copy()
Date::make('Created at', 'created_at')->copy()
Hide Value
The eye()
method adds a button to show/hide the field's value (for example, for passwords).
Date::make('Created at', 'created_at')->eye()
Date::make('Created at', 'created_at')->eye()
Lock
The locked()
method adds a lock icon to the field.
Date::make('Created at', 'created_at')->locked()
Date::make('Created at', 'created_at')->locked()
Suffix
The suffix()
method adds a suffix to the input field.
suffix(string $ext)
suffix(string $ext)
Preview Edit
This field supports preview editing.