function that returns models that do not have any tags of a type #450
Fredericld
started this conversation in
Ideas
Replies: 1 comment
-
Did you ever solve this? I have the same use case now. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Would it be possible to get a function that returns models that do not have any tags of a type?
This would be used for searches that are very strict where the tags have to match perfectly
I need to be able to retrieve models that do not have any tags of a particular type. For example, I have a car model with different type of tags.
Tags of type "manufacturer" would be 'Ferrari', 'MacLaren', ....
Tags of type "tyres" would be 'dry', 'wet', ....
Tags of type "gearbox" would be 'automatic', 'manual', .... etc
I need to be able to retrieve cars that have been strictly tagged with my selection
If I search for macLaren cars, I only want the cars tagged with macLaren to be retrieved. I do not want cars with MAcLaren and dry or wet tyres, or anything else
If I search for macLaren cars with dry tyres, I only want the cars tagged with macLaren and dry tyres to be retrieved. I do not want cars with macLaren and wet tyres, nor any type of gear box.
In the same breath, If I only search for automatic gear box and don't specify with tyres nor manufacturers, I only want the cars tagged with automatic gearbox to be retrieved. I do not want cars tagged with any manufacturer nor tyre type
The Spatie functions are great but it is not possible to selected a model using this kind condition unless we know the name of the tags we want to exclude. I have seen the without tags scope but it would be useful in my can to have without Any Tags Type
I would need something like this
$query->withAnyTags('macLaren', 'manufacturer') //exists and works
$query->withoutAnyTagsType('tyre') // need help with this
$query->withoutAnyTagsType('gear')
Beta Was this translation helpful? Give feedback.
All reactions