Bind $record in a custom action

Giving the following component:

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

    public function editAction(): Action
    {
        return Action::make('edit')
            ->mountUsing(function (Action $action, array $arguments): void {
                // Resolve 
                $record = Author::find($arguments['id']);

                // I'm guessing this, this will not work.
                $action->record($record);
            })
            ->form([
                TextInput::make('title'),
                Repeater::make('books')->relationship('books') // Repeater must know $record in order to work
            ])
            ->action(function (array $data, Model $record) {
                $record->update($data);
            })
    }
}


<div>

    Authors:

    <span>Guilherme Saade {{ ($this->editAction)(['id' => 1]) }}</span>
    <span>Dan Harrin {{ ($this->editAction)(['id' => 2]) }}</span>

    <x-filament-actions:modals/>
</div>


How can i make the repeater know that the record is the $record resolved on mount?

Made a little repro repo with everything set up, no need for migrations and seeders
https://github.com/saade/filament-lab/tree/action-record
Solution
Hey @Dan Harrin, is this something you could still work on? Or perhaps point me in the right direction. Thanks!

I think Bind $record in a custom action got implemented since when i've created this thread, the issue seems to be solved, thank you!
Was this page helpful?