Open Modal through URL

I have a table of documents that need reviewed and when opened, they open in a slideover. Emails are sent out that a new document needs reviewed. Id love to be able to trigger the table row Action that launches the form modal through a url. Suggestions for doing this? Do I simply look for a particular request() and use emit? Not sure on how i would trigger the Action though.
6 Replies
Dan Harrin
Dan Harrin2y ago
unfortunately livewire doenst make it easy, since you cant dispatch browser events from mount()
Mark Chaney
Mark ChaneyOP2y ago
ah yes, i always forget that
Dan Harrin
Dan Harrin2y ago
the only way you could do it is through a wire:init hack wire:init="mountAction('name')" but it has to be in the html
Mark Chaney
Mark ChaneyOP2y ago
i might consider that. not admin panel related, so a bit easier to modify that ok, so im partly there, can i actually launch a table action like so?
$this->mountTableAction('editDocumentAction', $record);
$this->mountTableAction('editDocumentAction', $record);
right now its saying its null. Ive verified $record is the same format as its found in
->actions([
EditAction::make('editDocumentAction')
->label('View')
->modalHeading(fn($record) => 'View Document: ' . $record->upload_type->name)
->form(function ($record) {
ray($record)->orange()->label('record from table action');
return $record->getEditForm($this->refreshUploadTypes($record->upload_type_id));
})
->slideOver()
->action(function ($data, $record) {
$record->update(collect($data)->only(['status', 'upload_type_id', 'description'])->toArray());
}),
DeleteAction::make()->visible(fn($record) => request()->user()->canManageProperty($record->property)),
])
->actions([
EditAction::make('editDocumentAction')
->label('View')
->modalHeading(fn($record) => 'View Document: ' . $record->upload_type->name)
->form(function ($record) {
ray($record)->orange()->label('record from table action');
return $record->getEditForm($this->refreshUploadTypes($record->upload_type_id));
})
->slideOver()
->action(function ($data, $record) {
$record->update(collect($data)->only(['status', 'upload_type_id', 'description'])->toArray());
}),
DeleteAction::make()->visible(fn($record) => request()->user()->canManageProperty($record->property)),
])
when click on the actual action. Just getting null on the $record when i try to pass it in my first code
awcodes
awcodes2y ago
I think mountTableAction() needs a record key as a string for the second param.
awcodes
awcodes2y ago
GitHub
filament/action.blade.php at 2.x · filamentphp/filament
Admin panel, form builder and table builder for Laravel. Built with the TALL stack. Designed for humans. - filament/action.blade.php at 2.x · filamentphp/filament
Want results from more Discord servers?
Add your server