V
V
Vitaly2019-10-09 11:14:18
Laravel
Vitaly, 2019-10-09 11:14:18

WHERE->WHERE only returns the first result?

Good afternoon.

$fixе = Fix::whereDate('date', $date)->get();
$glOd = Od::whereDate('date', $date);
foreach ($fixе as $fix){
$od = $glOd->where('fix_id', $fix->sm_id)->get();
}

returns the result only once, that is, as a result, an object consisting of 157 is returned to me, but $ od is empty in all but the first, although if you make a query in the database, then there is data.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question