problems with query eloquen laravel 5.5

0

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?

    
asked by zereft 01.12.2018 в 23:38
source

1 answer

1

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

    
answered by 02.12.2018 / 01:46
source