laravel 5 - How do I call a batch of Laravel5 commands? -
laravel 5 - How do I call a batch of Laravel5 commands? -
i have few complex commands split "sub commands" (example following). site multi-domain, need capability of customizing sequence , composition of sub commands perform (so far had in config under l4). migration l5, i'm refactoring functionality using command bus.
example of command sequence: site a:
1) authorizecharge 2) dosomethinga 3) dosomethingb 4) charge site b
1) authorizecharge 2) dosomethinga 3) dosomethingc 4) dosomethingd 5) charge each of these line items command it's handler. part clear me (and works fine).
how can dispatch elegantly in controller?
here tried.
fixed version (works)(in controller):
$return = $this->dispatch( new dosomethingacommand($form)); $return[] = $this->dispatch( new dosomethingbcommand($form)); variable version (pseudo code):
someconfig.php
return [ 'dosomethingacommand', 'dosomethingbcommand' ]; app\namespace\http\controller\somecontroller.php
... //loop on scenario commands ($j = 0; $j < count($commands); $j++) { //make object need deed on $object = \app::make( $this->_namespace . '\\'. $commands[ $j ] ); $return[] = $this->dispatchfrom( $object, $form ); //doesnt work } i'm bit stuck on how solve this. advice on how implement this?
why dont have main command calls other sub-commands itself?
so have 1 major command called controller called handlepaymentprocesscommand. within command phone call sub-commands
1) authorizecharge 2) dosomethinga 3) dosomethingc 4) dosomethingd 5) charge this way sub-commands handled in 1 location (the main command) - , configurable changed.
laravel-5 bus
Comments
Post a Comment