Could not save other model relation data

I have a product model and productpromotion model, product model will have many promotions, how can we save relation from productmodel resource ? Group::make() ->relationship('promotion') ->schema([ TextInput::make('promotion_label') ->label('Label'), TextInput::make('discount_percentage') ->label('Discount Percentage'), TextInput::make('base_price') ->label('Base Price'), i ended up getting this error SQLSTATE[HY000]: General error: 1364 Field 'product_model_id' doesn't have a default value (Connection: mysql, SQL: insert into product_model_promotions (promotion_label, discount_percentage, base_price, is_free_pickup, starts_at, ends_at, updated_at, created_at) values (?, ?, ?, 0, ?, ?, 2024-09-26 17:34:15, 2024-09-26 17:34:15))
1 Reply
Lara Zeus
Lara Zeus3mo ago
check this section in the docs maybe its related! https://filamentphp.com/docs/3.x/forms/advanced#saving-data-to-a-belongsto-relationship also not sure if Group accept 'many relations'!
Want results from more Discord servers?
Add your server