Max Net Max Net - 3 months ago 35
PHP Question

How to combine results of two query from Eloquent Model in Laravel?

I have two query to database:

$words = Word::where('word','LIKE',"%{$search}%")

$words_default = DefaultWord::where('word','LIKE',"%{$search}%")

How I can combine results to one var?

Answer Source

You can use the merge method:

$merged = $words->merge($words_default);

More info:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download