I follow this rule: Controllers are strictly for resource I/O, so a controller at max can only have seven public methods (one for each Restful actions). If it's not one of the following
... I move it to a separate controller. So let's say an article can be upvoted; instead of a custom ArticleController@upvote method, I create an UpvoteController@store instead. Take note that an upvote is not a concrete Eloquent model, but it can still be considered a resource.
TL;DR: A Controller doesn't necessarily have to map with an Eloquent model. Use it to group resource-related logic so you don't have to write custom controller methods.
Edit: I may have butchered that concept, I'm quite tired and can't type properly lol.
To aid in the logical organization of my code, I link a set of features to related table(s) and logic such that it ends up having corresponding model(s), controller(s) and views. For example, say I have a set of features called "Admin {CRUD}" I'll create a table called "users" or "admins", then I'll create a model called "User" or "Admin", then a controller called "AdminController" with my logic going into the controller.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I follow this rule: Controllers are strictly for resource I/O, so a controller at max can only have seven public methods (one for each Restful actions). If it's not one of the following
... I move it to a separate controller. So let's say an article can be upvoted; instead of a custom
ArticleController@upvotemethod, I create anUpvoteController@storeinstead. Take note that an upvote is not a concrete Eloquent model, but it can still be considered a resource.TL;DR: A Controller doesn't necessarily have to map with an Eloquent model. Use it to group resource-related logic so you don't have to write custom controller methods.
Edit: I may have butchered that concept, I'm quite tired and can't type properly lol.
Nice!. Please add a number so we can all keep track of the rules. LOL!
OK, I'll go first: