/**
  * Execute a command.
  *
  * @param $command
  * @return mixed
  */
 public function execute($command)
 {
     $validator = $this->translator->toValidator($command);
     if (class_exists($validator)) {
         $this->app->make($validator)->validate($command);
     }
     return $this->bus->execute($command);
 }
 /**
  * Execute a command with validation.
  *
  * @param $command
  * @return mixed
  */
 public function execute($command)
 {
     // If a validator is "registered," we will
     // first trigger it, before moving forward.
     $this->validateCommand($command);
     // Next, we'll execute any registered decorators.
     $this->executeDecorators($command);
     // And finally pass through to the handler class.
     return $this->bus->execute($command);
 }
Example #3
0
 /**
  * @expectedException Bdsm\Exception\HandlerNotFound
  */
 function test_it_throws_when_handler_not_found()
 {
     $bus = new CommandBus();
     $bus->handle(new FooCommand());
 }