F
Filament17mo ago
Mingo

add timestamp in form

Hi, how can i create a timestamp like this in form builder?
7 Replies
moaaz_m_f
moaaz_m_f17mo ago
this is one way of doing it make sure you have the
$table->timestamps();
$table->timestamps();
in your table migration i usually add created_by and updated_by also.
->schema([
Forms\Components\Placeholder::make('created_at')
->label('Created at')
->content(fn (Order $record): ?string => $record->created_at?->diffForHumans()),

Forms\Components\Placeholder::make('updated_at')
->label('Updated at')
->content(fn (Order $record): ?string => $record->updated_at?->diffForHumans()),
])
->columns(1)
->hidden(fn (?Order $record) => $record === null),
->schema([
Forms\Components\Placeholder::make('created_at')
->label('Created at')
->content(fn (Order $record): ?string => $record->created_at?->diffForHumans()),

Forms\Components\Placeholder::make('updated_at')
->label('Updated at')
->content(fn (Order $record): ?string => $record->updated_at?->diffForHumans()),
])
->columns(1)
->hidden(fn (?Order $record) => $record === null),
ByteXR
ByteXR17mo ago
Cannot wait for v3 and infolists for all view only data 😍
Mingo
Mingo17mo ago
Thanks for the help Ok thanks i will try Do you know when the v3 will be released?
Mingo
Mingo17mo ago
Thanks for the info
Filament
Filament17mo ago
Beta: 25d 04h 49m 01s Release: 36d 22h 49m 01s
Want results from more Discord servers?
Add your server