<?php
class ServerDetails extends Widget implements HasInfolists
{
use InteractsWithInfolists;
protected static string $view = 'filament.resources.assets-object-resource.widgets.server-details';
public Server $record;
public function getObjectDetailsInfoListProperty(Infolist $infolist): Infolist
{
return $infolist
->record($this->record)
->name('Server details')
->schema([
Section::make('Server details')
->schema([
TextEntry::make('customer.name')
->label(__('Customer'))
->suffixActions([
Action::make('update')
->icon('heroicon-m-pencil-square')
->form([
TextInput::make('name')
])
->action(function (array $data, $record): void {
$record->name = $data['name'];
$record->save();
})
])
]),
]);
}
}
<?php
class ServerDetails extends Widget implements HasInfolists
{
use InteractsWithInfolists;
protected static string $view = 'filament.resources.assets-object-resource.widgets.server-details';
public Server $record;
public function getObjectDetailsInfoListProperty(Infolist $infolist): Infolist
{
return $infolist
->record($this->record)
->name('Server details')
->schema([
Section::make('Server details')
->schema([
TextEntry::make('customer.name')
->label(__('Customer'))
->suffixActions([
Action::make('update')
->icon('heroicon-m-pencil-square')
->form([
TextInput::make('name')
])
->action(function (array $data, $record): void {
$record->name = $data['name'];
$record->save();
})
])
]),
]);
}
}