You can make your work a lot easier using Laracasts/Commander which based on commands.
Also checkout Jeffrey Way Commander (https://laracasts.com/search?q=commander&q-where=lessons).
Your controller will look like:
- Fetch input
- Call validator
- Call
$this->execute(New SubscribeUserCommand($email, $data1, $data2))
which calls SubsribeUserCommandHandler handle method. A command is a simple data object holding everything the handle method needs. - Inside the command handler call any other commands to process your request
- Look at the result of your command handler and display the required data to the user.
Commander also highly recommends you work with events to trigger email, or notifications...
Ups:
- Few dependencies in your controller,
- Readable controller
- Test each command separately
Down: - More classes and offert required to set it up
Hope this helps or at leasts gives you an idea how to solve your problem. I using this method in my project where users registers, receives welcome e-mail, roles... my controller is about 5 lines long the rest is inside commands and command handlers