Watch the talk made by Adam Wathan many years ago. It's called "Cruddy by Design".
Best design practices for controllers
I have a Laravel app that has grown beyond its initial scope, and I want to refactor it.
The app has a student table that stores individual student information for students in an IT degree. The app then has four other tables that store information about each student's C panel account, confluence account, jira account, and bitbucket account.
In the student controller, I query multiple models, and in the student view, I display a table that contains data from multiple models that I build in the student controller using DataTables. I also use the student controller to create new records in the other database tables when a new student is added.
I have too much logic in the student controller and am about to refactor it into a service class. However, this has me thinking about design practices for controllers.
When I created my app, I created migrations, seeders, models, and controllers for students, cPanel accounts, Jira accounts, Confluence accounts, and Bitbucket accounts.
From a design practice point of view, is it OK for the student controller to query and update multiple models in addition to students?
Or should I have created an additional controller for this purpose?
Thanks!
Please or to participate in this conversation.