I tried to translate this query to eloquent , but it still does not work for me, I just want to see it based on a field with no null
values.
select * from usuarios where asignacion is not null;
How can I do it?
I tried to translate this query to eloquent , but it still does not work for me, I just want to see it based on a field with no null
values.
select * from usuarios where asignacion is not null;
How can I do it?
With the help of the whereNotNull()
method that receives the column where you want to do the verification, you can do it using the model if you have one; so
$data = User::whereNotNull('asginacion')->get();
Or with the queryBuilder like this
$data = \DB::table('usuarios')->whereNotNull('asginacion')->get();
Here you have the reference of the documentation