are you sure its this query? It seems reasonable.
try dd($groups) immediately after the ->get()
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello, for some reason, for a simple mysql query, I do not have enough memory, while it always works. I must have an error in my request.
Model:
$groups = DB::table('group')
->join('organisation', 'group.oid', '=', 'organisation.oid');
if(Input::get('search')){
$groups->where('group.group_name', 'LIKE', '%'.$search.'%')
}
if($oid!='0'){
$groups->where('group.oid', '=', $oid);
}
$groups->offset($limit)
->limit(30)
->get();
return $groups;
Error:
Allowed memory size of 134217728 bytes exhausted (tried to allocate 67112960 bytes)
Best regards
Found, I use the when statement and it's working !
https://laravel.com/docs/5.5/queries#conditional-clauses
Thank you @Snapey
Please or to participate in this conversation.