W
W
WebDev2016-08-05 15:57:23
Laravel
WebDev, 2016-08-05 15:57:23

Laravel chunk with condition not working?

There are tables entities and urls, relation oneToMany.
This code doesn't output anything

Entity::where('id', 89)->whereNotExists(function($query) {
            $query->from('urls')->where('url', 'like', '%itunes%');
        })->get();

But this one displays, although it does not fall under the condition
Entity::where('id', 89)->whereNotExists(function($query) {
            $query->from('urls')->where('url', 'like', '%itunes%');
        })->chunk(200, function($entities) {
            dd($entities->toArray());
        });

Why, if using chunk, the condition doesn't work?

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