skadevz
skadevz

Reputation: 59

LARAVEL Fatal Error Exception : Allowed memory size of 134217728 bytes exhausted (tried to allocate 10489856 bytes)

i want to run this code

$late = Attendance::whereUserType(5)
         ->where('datetime_in', '!=', null)
         ->where(DB::connection('attendance')
         ->raw('DATE(created_at)'), date('Y-m-d'))
         ->orderBy('user_id')->get()->take(10);

but i got an error like in the title said. When i change the memory_limit to 512M, my browser is lag. I'm using 16K+ data for testing, is it ok ?? And what is the problem ??

Upvotes: 3

Views: 13017

Answers (2)

Cengkuru Michael
Cengkuru Michael

Reputation: 4780

Try to add this on top of the script

ini_set('memory_limit','512M');

Your query could be timing out

Upvotes: 6

rikardo_paiva
rikardo_paiva

Reputation: 393

Try to invert the way you search, changes get()->take(10) to take(10)-> get()

Upvotes: 3

Related Questions