RFFRED
1 month ago
291
12
Laravel

Having several repositories attached a controller

Posted 1 month ago by RFFRED

Hi,

I have read using Eloquent is not great in terms of performance when used with databgrids.

I currently have an Eloquent repository attached to a controller and I am wondering if it is a good idea to attach another repository that uses DB. Or alternatively, would I put the functions that use DB inside the Eloquent repository?

I guess I could just put in my controller

$data = DB::select('select * from users');

But I would rather use a repo since I have using that

Also, it's not that I am likely to change my storage system. But I quite like the fact my queries are away from my controller

Please sign in or create an account to participate in this conversation.