I'm developing a Laravel Web App and I need insight in refactoring my Controller.
I noticed that my Controller store() and update() methods are VERY similiar. So similar that the only line that changes are the following:
In the store() method I use $deck = new Deck();
and in the update() method I use $deck = Deck::find($id);
. These are the only lines that change in these 140 line each methods inside the Controller.
How can I refactor or to where should I extract this code? My first thought was to create a Trait and put the method there, but that doesn't seem right, or does it?