Releationship is ignoring where in the relations #630
-
The problem is I see in the select ALL the user NOT ONLY the one with 'techer' as pivot role table. How can I prefilter these entries? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
@realtebo we use the model to get the options, you add the constrain in the relation for the pivot table, not the model. You can configure the options like in any other select: 'pivotSelect' => [
'options' => function($model) {
return $model->whereIn('id', [1,2]);
},
], Cheers |
Beta Was this translation helpful? Give feedback.
-
I've added more examples for Also added a title for it to make it easy to find while searching in the docs. Thanks 🙏 |
Beta Was this translation helpful? Give feedback.
@realtebo we use the model to get the options, you add the constrain in the relation for the pivot table, not the model.
You can configure the options like in any other select:
Cheers