Creating custom livewire action Componente using relationships

Hey guys.

I'm trying to create a Livewire component that will return an Action where I'm using
->fillForm(function ()
to fill a multi-select with tag options.

It works perfectly when I'm using this action directly on my resource, using headerFunction from View page, but using a custom livewire component doesn't work. Taking a look I imagine that is something related with relationships.

Blade:
<livewire:manage-tag-action :model="$client"/>

Component:

class ManageTagAction extends Component implements HasForms, HasActions
{
    use InteractsWithForms;
    use InteractsWithActions;

    public Tag   $tag;
    public Model $model;

    public function mount(Tag $tag, Model $model)
    {
        $this->tag   = $tag;
        $this->model = $model;
    }
Solution
You need to provide your model to the action. Probably

->record(fn ($livewire) => $livewire->model) or similar
Was this page helpful?