Moving to a model seems more appropriate since this helper interacts with database. Utilize local scope: https://laravel.com/docs/13.x/eloquent#local-scopes
Apr 2, 2026
3
Level 2
Controller's helper fn
Where should i keep the helper fn that fetches some data from a particular db table and is then used extensively across only two controller classes? Should i keep it as a private member function in both controllers and then invoke it in other member functions as:
$result = this->myFn();
Or should I move it to a model, mark it as static and then in my controllers invoke it as:
$result = SomeModel::myFn();
Please or to participate in this conversation.