How to pass Entry id into ViewField

I want do something like this in my resource:
ViewField::make('frontend-link')
->view('filament.fields.frontend-link')
->viewData([
'id' => $modelId // A closure seems not to be an option
// 'id' => fn (Model $record): ?string => $record->id // Not working
])
ViewField::make('frontend-link')
->view('filament.fields.frontend-link')
->viewData([
'id' => $modelId // A closure seems not to be an option
// 'id' => fn (Model $record): ?string => $record->id // Not working
])
What's the best way to pass my model id into the view?
2 Replies
Jonas Siewertsen  πŸ‡ͺπŸ‡Ί
From the docs: https://filamentphp.com/docs/2.x/forms/fields#view I am just not sure how I can access the model data in my blade view.
Filament
Fields - Form Builder - Filament
The elegant TALL stack form builder for Laravel artisans.

Did you find this page helpful?