Create action with relation manager

I don't get it about why I need product_id in my stocks relation manager like that?

stock relation manager
protected static string $relationship = 'stocks';

->headerActions([
    Tables\Actions\CreateAction::make()
        ->using(
            fn(array $data, string $model): Model => $model::create([
                'product_id' => $this->ownerRecord->id,
                'remaining_stock' => 0,
                'price' => $data['price'] ?? 0,
                'cost' => $data['cost'] ?? 0,
                'adding_stock' => 0,
                'profit' => $data['profit'] ?? 0,
                'total_price' => 0, // This will be calculated later
            ])
        )
        ->slideOver()
        ->label('Add New')
        ->icon('heroicon-o-plus')
        ->modalWidth(MaxWidth::Large),
])
Was this page helpful?