Reputation: 5004
I have two query to database:
$words = Word::where('word','LIKE',"%{$search}%")
->limit(10)
->get();
$words_default = DefaultWord::where('word','LIKE',"%{$search}%")
->limit(10)
->get();
How I can combine results to one var?
Upvotes: 4
Views: 6747
Reputation: 2047
You can use the merge
method:
$merged = $words->merge($words_default);
More info: https://laravel.com/docs/5.5/collections#method-merge
Upvotes: 3