I'm having problems with the array returned with DB::select() . I heavily use skip and take in Collections for the eloquent models in my API. Unfortunately, DB :: select returns an array, which obviously does not work with skip and take. How can I convert arrays to a collection that can use these methods?
I tried
\Illuminate\Support\Collection::make(DB::select(...));
This does not work as I expected, as it wraps the entire array in the collection, rather than individual results.
Is it possible to convert a return from DB::select to a "native" collection that can use the skip and take methods?
Update
I also tried:
$query = \Illuminate\Support\Collection::make(DB::table('survey_responses')->join('people', 'people.id', '=', 'survey_responses.recipient_id')->select('survey_responses.id', 'survey_responses.response', 'survey_responses.score', 'people.name', 'people.email')->get());
What else is telling me:
FatalErrorException in QueryHelper.php line 36: Call to a member function skip() on array
Greetings
source share