我应该如何在子句中使用一个以上的一个值来检查一个字段
where("mime_type", "not like", "image%")
->where("mime_type", "not like", "video%")
->where("mime_type", "not like", "audio%")
->where("mime_type", "not like", "application%")
如何将所有这些都在laravel雄伟模型中的()中使用
where("mime_type", "not like", "image%")
->where("mime_type", "not like", "video%")
->where("mime_type", "not like", "audio%")
->where("mime_type", "not like", "application%")
how should use all of them in one where() in laravel eloquent model
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
在运行
- > where()
方法:或,不使用
array_map
:You'll have to prepare the data to be excluded before running the
->where()
method:or, without using
array_map
:您可以使用Wherenotin方法。
喜欢:
$ admins = \ app \ models \ users :: wherenotin('角色',['customer','雇员','vendor']) - > get();
,以便您得到不是
客户
,供应商
,员工
的用户的结果。You can use whereNotIn method.
Like:
$admins = \App\Models\Users::whereNotIn('role', ['customer','employee','vendor'])->get();
So You get results of users who are not
customer
,vendor
,employee
.使用Laravel的
或Where
方法。有关更多详细信息,请参阅文档 https://laravel.com/docs/ 9.x/查询#where-not-clauses
Use Laravel's
orWhere
method.For more detail please refer document https://laravel.com/docs/9.x/queries#where-not-clauses
尝试这个。将数组传递到Where子句中。
希望这对您有用。
Try this one. Pass array in where clause.
Hope this will work for you.
我有简单的方法来解决这个问题:
在
- > where()
之类的Where函数中制作功能:它将生成类似:
希望此帮助。
I have simple way to resolve this:
Make the where function inside
->where()
like this:It will generate like:
Hope this help.