May 9, 2024
0
Level 27
Providing a Livewire component with callbacks
I have a livewire text GenericEditor component that I would like to reuse as much as possible.
Some of the "events" that I'm interested in are like Save and Load
How do I wire up this component so that it knows which piece of Save/Load code to call?
As an example:
- In one case, I'm have a
BlogControllercontroller returning aview(..) - This
view()has a@livewire("generic-editor", ...) - When I click save,
GenericEditor::save()will be executed by livewire - In another case, I might need
GenericEditor::save()to callFaqController::save()instead - So in this case, how do I set things up so that
GenericEditor::save()will know to callBlogController::save()?
Please or to participate in this conversation.