Reputation: 12588
In Laravel 5.5, I am trying to get all fruits that have a fruit_id from an array like this..
$fruits = Fruit::whereIn('fruit_id',[6,23,5,73]);
This is not returning any results, am I doing this correctly or is there a better way of doing things?
Upvotes: 1
Views: 348
Reputation: 163758
You forgot to execute the query. Add ->get()
:
$fruits = Fruit::whereIn('fruit_id',[6,23,5,73])->get();
Upvotes: 4