[英]Where is not or where is different in laravel query builder
Hi my query checks if a field is not empty or the data is validated: 您好我的查询检查字段是否为空或数据是否已验证:
return $this->with(array('funcionario', 'item_contabil'))
->where('tb_horario.cod_funcionario', $codfunc)
->whereBetween('tb_horario.data', array($datainicio, $datafinal))
->where('tb_horario.validado', 0)
->where('tb_horario.motivo','<>', '')
->orderBy('tb_horario.data')
->count();
I want to know if in this line i can use something like whereNot() or whereDifferent() in laravel 4: 我想知道是否可以在laravel 4中使用whereNot()或whereDifferent()之类的东西:
->where('tb_horario.motivo','<>', '')
Exists something like that??? 存在类似的东西??? thxx!
thxx!
You can do a lot of things with Laravel Query Builder: 您可以使用Laravel Query Builder做很多事情:
Copied from the Docs(Advanced Wheres) : 从文档(高级位置)复制:
->where('tb_horario.cod_funcionario', '=', 'John')
->orWhere(function($query) {
$query->where('tb_horario.validado', '>', 100)
->where('tb_horario.motivo', '<>', '');
})->get();
Or something like this 或类似的东西
->where('tb_horario.cod_funcionario', '=', 'John')
->whereRaw('tb_horario.validado > 100');
->get();
Laravel offers several options to create queries... Laravel提供了几种创建查询的选项...
whereNotIn
whereNotExists
whereExists
...
Have a look at the API-Docs . 看一下API-Docs 。 I'm sure you'll find something, which suits you.
我相信您会找到适合您的东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.