how to add field to a view page?

I added a view page to a resource already existing
php artisan make:filament-page ViewPlaylist --resource=PlaylistResource --type=ViewRecord
php artisan make:filament-page ViewPlaylist --resource=PlaylistResource --type=ViewRecord
I registered the page in PlaylistResource::getPages()
public static function getPages(): array
{
return [
'index' => Pages\ListPlaylists::route('/'),
'view' => Pages\ViewPlaylist::route('/{record}'),
'create' => Pages\CreatePlaylist::route('/create'),
'edit' => Pages\EditPlaylist::route('/{record}/edit'),
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListPlaylists::route('/'),
'view' => Pages\ViewPlaylist::route('/{record}'),
'create' => Pages\CreatePlaylist::route('/create'),
'edit' => Pages\EditPlaylist::route('/{record}/edit'),
];
}
it created succesfully app/Filament/Resources/PlaylistResource/Pages/ViewPlaylist.php My question is: how and where must I add all the readonly fields I need?
Solution:
Found! because I don't want to edit, I didn't add inputs to form . I added and all is working...
Jump to solution
1 Reply
Solution
realtebo
realtebo5mo ago
Found! because I don't want to edit, I didn't add inputs to form . I added and all is working
public static function form(Form $form): Form
{
return $form
->schema([
TextInput::make('name')->label('nome'),
TextInput::make('description')->label('descrizione'),
]);
}
public static function form(Form $form): Form
{
return $form
->schema([
TextInput::make('name')->label('nome'),
TextInput::make('description')->label('descrizione'),
]);
}