Open utterances-bot opened 4 years ago
"we've started using a concept called "actions". I would say it is a Command pattern?
i have a question . does actions can use other actions for example PublishPostAction can have SendTweetAction as constructor dependency ?
and if yes can you tell me how do you solve circular dependencies if happened ?
Thanks a lot
I already do this, but with jobs, and particularly sync jobs. As @slk500 says, this is akin to commands (and not surprising given “queued jobs” in Laravel was borne out of the command bus that was introduced in 5.0 and gone by 5.1).
The make-up is the same: a job class has a single action, can be called in a controller or console command, and can be queued.
Refactoring to actions - Freek Van der Herten's blog on PHP, Laravel and JavaScript
Freek Van der Herten is a developer and partner at Spatie.
https://freek.dev/1371-refactoring-to-actions