Recently I watched the "Lets Build A Forum" series and made some choices to refactor a site from a year ago. Mostly I noticed my controllers were getting bloated with custom methods as opposed to a
CRUD setup (
index, create, store, edit, update, show, destroy). In the series it mentions to stay away from custom methods if you can, which i would agree with but sometimes I have some methods that don't fall in those categories.
I have a
LeagueController to which a
league can do the standard
CRUD methods but also I have some other situations that dont fall inline such as
Join: when a posted to this route it will let a league owner know a user wants to join and adds that
user to the
league_user table waiting to be approved
Approve: If the league owner approves, a post hits this method and looks up the user on the
league_user table and makes
approved pivot column
Now my question is what is best practice here? Just make custom methods? Make a new controller like
ApprovalController then have
Update? Just want to make sure my code is not a hot mess.
Any input would be great!
Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.