Reputation: 515
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:
->where('tb_horario.motivo','<>', '')
Exists something like that??? thxx!
Upvotes: 0
Views: 1870
Reputation: 5133
You can do a lot of things with 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...
whereNotIn
whereNotExists
whereExists
...
Have a look at the API-Docs. I'm sure you'll find something, which suits you.
Upvotes: 1