Adding different pivotData in N:N relationship
My Property and PropertyFeature has N:N relationship. And I have additional pivot table fields ( ‘number’, ‘max number’, and ‘selected_types’ as a json field).
PropertyFeature has feature 'name' and 'type' field as json. In my pivot table I want to multi-select the json data based on the available options from json 'type' field data in PropertyFeature. This i want to do while creating Property Record. I have so far below code in my Property resource file. What approach I should take for making entry in pivot table for each selected PropertyTypeFeatures. And how?
PropertyFeature has feature 'name' and 'type' field as json. In my pivot table I want to multi-select the json data based on the available options from json 'type' field data in PropertyFeature. This i want to do while creating Property Record. I have so far below code in my Property resource file. What approach I should take for making entry in pivot table for each selected PropertyTypeFeatures. And how?
Solution:Jump to solution
I used below code to solve my challenge. I used repeater in BelongsToMany relationship and used dependent select.
```
Forms\Components\Select::make('property_type_id')
->relationship(name: 'propertyType', titleAttribute: 'name', modifyQueryUsing: function (Builder $query, Get $get) {...
1 Reply
Solution
I used below code to solve my challenge. I used repeater in BelongsToMany relationship and used dependent select.