Supergribbs
Supergribbs
FFilament
Created by Supergribbs on 4/12/2024 in #❓┊help
Call the "edit" modal for a record in a resource from a different page
3/ In your component blade view, include the modals : <x-filament-actions::modals /> 4/ On every button or element where you need to bind a createAction, add this :
[...]
type="button"
wire:loading.attr="disabled"
wire:click="mountAction('create_app_models_[LOWERCASE RESOURCE NAME]')"
wire:target="mountAction('create_app_models_[LOWERCASE RESOURCE NAME]')"
aria-label="Add a [RESOURCE NAME]"
[...]
type="button"
wire:loading.attr="disabled"
wire:click="mountAction('create_app_models_[LOWERCASE RESOURCE NAME]')"
wire:target="mountAction('create_app_models_[LOWERCASE RESOURCE NAME]')"
aria-label="Add a [RESOURCE NAME]"
5/ Same thing on every button or element where you want to bind an editAction but with the ID passed :
wire:click="mountAction('edit_app_models_[LOWERCASE RESOURCE NAME]', { 'id': '{{ [ID OF THE TUPLE TO EDIT] }}' } )"
wire:target="mountAction('edit_app_models_[LOWERCASE RESOURCE NAME]', { 'id': '{{ [ID OF THE TUPLE TO EDIT] }}' } )"
wire:click="mountAction('edit_app_models_[LOWERCASE RESOURCE NAME]', { 'id': '{{ [ID OF THE TUPLE TO EDIT] }}' } )"
wire:target="mountAction('edit_app_models_[LOWERCASE RESOURCE NAME]', { 'id': '{{ [ID OF THE TUPLE TO EDIT] }}' } )"
And it ... kinda just works 🙂 See captures attached. Of course, this is a very straightforward version with hardcoded names (as it suits my needs here) but check https://github.com/awcodes/filament-quick-create/blob/3.x/src/QuickCreatePlugin.php for a more flexible way of doing this. (Ping @Zep Fietje, here is the explanation ! )
5 replies
FFilament
Created by Supergribbs on 4/12/2024 in #❓┊help
Call the "edit" modal for a record in a resource from a different page
No description
5 replies