FilamentF
Filament2y ago
SamN

Detach Action Removing every record in Pivot table

My problem is detach action removes every pivot record that has the vehicle_make_id. How can I fix this?

Fitments pivot has a primary id. I expect the detach to use the primary id.

App\Models\Parts.php
class Part extends Model { public function fitments(): BelongsToMany { return $this->belongsToMany(VehicleMake::class, 'fitments', 'part_id', 'vehicle_make_id')->withPivot(['vehicle_model_id', 'vehicle_trim_id', 'vehicle_year_id']); } }

PartResource\RelationManagers\FitmentsRelationManager.php;

->actions([ Tables\Actions\DetachAction::make(), ])
Was this page helpful?