Filament Repeater Not Passing Foreign Key (make_id) - SQL Error 1364

I'm using a Filament Repeater to add vehicle compatibility records in my Laravel app. The make_id field is a foreign key, but when saving, I get this error:
SQLSTATE[HY000]: General error: 1364 Field 'make_id' doesn't have a default value (Connection: mysql, SQL: insert into part_compatibility (part_id, updated_at, created_at) values (29, 2025-02-04 08:42:29, 2025-02-04 08:42:29))

CompatibilitiesRelationManager file attached

Part Model:
class Part extends Model { protected $fillable = [ 'supplier_id', 'part_name', 'part_number', 'brand', 'description', 'category', 'unit_of_measurement', 'stock_level', 'quantity_per_unit', 'purchase_price', 'selling_price', 'remarks', ]; public function supplier() { return $this->belongsTo(Supplier::class, 'supplier_id'); } public function compatibilities() { return $this->hasMany(PartCompatibility::class); } }


PartCompatibility Model:
class PartCompatibility extends Model { protected $table = 'part_compatibility'; protected $fillable = [ 'part_id', 'make_id', 'model_id', 'years', ]; protected $casts = [ 'model_id' => 'array', // Cast model_id to an array 'years' => 'array', // Cast years to an array ]; public function part() { return $this->belongsTo(Part::class, 'part_id'); } public function make() { return $this->belongsTo(VehicleMake::class, 'make_id'); } public function model() { return $this->belongsTo(VehicleModel::class, 'model_id'); } }
Was this page helpful?