Support the ongoing development of Laravel.io →
Database Eloquent

I'm working with some log data and it returns about hundreds and thousands of data.

Without using chunk(), how can I use eloquent or query builder to return all the data as an array?

I've tried LogData::where('user_id', 123)->get()->toArray(); and LogData::where('user_id', 123)->toArray(); but it seems that toArray() can only be used on single data

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

wyred wyred Joined 5 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.