Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

laracoft's avatar

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:

  1. In one case, I'm have a BlogController controller returning a view(..)
  2. This view() has a @livewire("generic-editor", ...)
  3. When I click save, GenericEditor::save() will be executed by livewire
  4. In another case, I might need GenericEditor::save() to call FaqController::save() instead
  5. So in this case, how do I set things up so that GenericEditor::save() will know to call BlogController::save()?
0 likes
0 replies

Please or to participate in this conversation.