Support the ongoing development of Laravel.io →
posted 10 years ago
Database

I am trying to write a global fn for my cat system that is in the base controller. here is the fn inside the base cont

public function rec_cat($table,$col,$col_id,$rec_arr=array()) { $ups=DB::table($table)->where($col,$col_id)->get(); foreach ($ups as $up) { $rec_arr[]=$up; $this->rec_cat($table,$col,$col_id,$rec_arr); } return $rec_arr; }

when I try to call this fn in my controller $select=$this->rec_cat('kategori','up_id','0'); return var_dump($select); I get this error Allowed memory size of 134217728 bytes exhausted (tried to allocate 196605 bytes)

The bytes written in the error is smaller than the allowed memory size so I think I have another problem.

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

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.