I've got 2 classes in my application both have their own Controller. Week -> WeekController Day -> DayController
When a new week is created I also want to create 5 (work)days for that week.
At this point I make a call from the create method in the WeekController to the create method in the DayController:
app('App\Http\Controllers\DayContoller')->create($week->id);
This post mentions this as being a bad practice. The alternatives offered however don't seem better in my case: A week doesn't really extend a day and using a trait would feel strange to me in this scenario as well.
So I wonder, what's the best solution in this scenario. I'm pretty sure this is something that's pretty common.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire