Add preview button to modal - get record

I want to add a preview button to an edit modal. however im unable to get the record that is being modified.
->extraModalActions([
// Action::make('preview')
\Filament\Forms\Components\Actions\Modal\Actions\Action::make('preview')
->url(function (Notice $record) {
return URL::temporarySignedRoute('notice-preview', now()->addMinute(), [
'notice' => $record,
]);
})
])
->extraModalActions([
// Action::make('preview')
\Filament\Forms\Components\Actions\Modal\Actions\Action::make('preview')
->url(function (Notice $record) {
return URL::temporarySignedRoute('notice-preview', now()->addMinute(), [
'notice' => $record,
]);
})
])
* im getting error - Missing required parameter for [Route: ...
10 Replies
Lara Zeus
Lara Zeus17mo ago
what is the parameters for the route notice-preview
Dennis Koch
Dennis Koch17mo ago
Check whether $record is available and not null via dd(). Not sure whether it is. Maybe you need $livewire and $livewire->getRecord() or $livewire->record
ericmp #2
ericmp #2OP17mo ago
i did info($record) before returning i get: [2023-07-25 11:45:01] local.INFO: [] so the route is fine, is the record that is empty from where do i can get the variable $livewire? i pass it to the anonymous fn, next to the record?
toeknee
toeknee17mo ago
yes
toeknee
toeknee17mo ago
Filament
Relation managers - Resources - Admin Panel - Filament
The elegant TALL stack admin panel for Laravel artisans.
ericmp #2
ericmp #2OP17mo ago
RelationManager doesnt exist im not using admin panel
toeknee
toeknee17mo ago
This is showing an example of the use of livewire.
ericmp #2
ericmp #2OP17mo ago
but i need to use the RelationManager class, dont i? if so, i cant import it use Filament\Resources\RelationManagers\RelationManager; otherwise i dont understand what i have to do
toeknee
toeknee17mo ago
No you define the class in use so which is a livewire component. ReltionManager is a livewire component which explains how $livewire can be used in that scenario. Deep dive on the vendor code you'll understand it better.
ericmp #2
ericmp #2OP17mo ago
okay, thanks hmm
Want results from more Discord servers?
Add your server