Is it possible to get ownerRecord directly in mutateFormDataUsing?

I have the following code and was wondering if it's possible to auto-inject $ownerRecord as an argument or my example is the only way right now.

    public static function table(Table $table): Table
    {
        return CategoryResource::table($table)
            ->appendHeaderActions([
                Tables\Actions\CreateAction::make()
                    ->mutateFormDataUsing(function (array $data, RelationManager $livewire): array {
                        /** @var \App\Models\Category $ownerRecord */
                        $ownerRecord = $livewire->ownerRecord;

                        $data['menu_id'] = $ownerRecord->menu_id;
                        return $data;
                    })
            ]);
    }
Was this page helpful?