简体   繁体   English

Laravel查询-whereJsonContains()反向

[英]Laravel Query - whereJsonContains() reverse

It's possible to write in Laravel query reverse for whereJsonContains() query, something like: whereJsonDoesntContains() ? 可以在Laravel查询反向中为whereJsonContains()查询编写内容,例如: whereJsonDoesntContains()吗?

I have problem with data filtering in Model. 我在模型中进行数据过滤时遇到问题。 This code works perfectly: 这段代码可以完美地工作:

$query->whereHas('attributes', function($q) use ($attribute)
{
    $q->where('attribute_product.attribute_id', $attribute->id)
      ->whereJsonContains('attribute_product.values', $someValue);
});

Now I want to create another query that returns products whereHas attributes with ID and JSON array in values column doesn't contain my variable. 现在,我想创建另一个查询,该查询返回的产品的“值”列中具有ID和JSON数组的属性不包含我的变量。

Do you have any idea to do this? 你有什么想法吗?

是的,有一个像这样的函数: whereJsonDoesntContain

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM