Custom table action for related resources

I have missions and goals components. In the missions component, I created a "Create Goal" table action which renders a modal to add a goal for that mission. When I click submit, it wants to add the record to the missions table, not the goals table. Here's my action code. How do I get it to save to the goals table, also, how do I pass the mission_id to this action?

    protected function getTableActions(): array
    {
        return [
            CreateAction::make('Create Goal')
                ->form(function (Goal $goal) use ($user) {
                    $form = Form::make('createGoal', [
                        'model' => $goal,
                    ]);
                    $form->schema([
                        Hidden::make('mission_id')
                            ->default(mission_id value???)
....
Was this page helpful?