ziffmedia / nova-select-plus

A Laravel Nova Select Field
MIT License
95 stars 26 forks source link

How filter belongsToMany ? #10

Closed piterssson closed 4 years ago

piterssson commented 4 years ago

I would like to add clausere "where" from select belongsToMany. Now when added join and where show all fields....

ralphschindler commented 4 years ago

Sorry, I don’t think I understand, perhaps you can explain your request with a use case?

piterssson commented 4 years ago

Sorry, I don’t think I understand, perhaps you can explain your request with a use case?

I would like to add where (query builder) to query in SelectPlus field

ralphschindler commented 4 years ago

So, to understand better, you want a way that you can filter out specific relational models that can be attached/synced to a particular resource/model specifically when it is not searchable? (You are able to do any kind of ->where() or other query methods if you are making the select ajaxSearchable, as in the docs.)

like:

SelectPlus::make('States Lived In', 'statesLivedIn')
    ->optionsQuery(function ($query) {
        $query->where(..');
    });

does that sound like what you're asking for?

piterssson commented 4 years ago

So, to understand better, you want a way that you can filter out specific relational models that can be attached/synced to a particular resource/model specifically when it is not searchable? (You are able to do any kind of ->where() or other query methods if you are making the select ajaxSearchable, as in the docs.)

like:

SelectPlus::make('States Lived In', 'statesLivedIn')
    ->optionsQuery(function ($query) {
        $query->where(..');
    });

does that sound like what you're asking for?

great :) thanks

ralphschindler commented 4 years ago

Added in v1.0.7