/** * If appropriate, validate command data. * * @param $command */ protected function validateCommand(Command $command) { $validator = $this->commandTranslator->toValidator($command); $validators = $this->app->config->get('app.validators.' . $validator, [$validator]); foreach ($validators as $validator) { if (class_exists($validator)) { $this->app->make($validator)->validate($command); } } }
/** * Execute the command * * @param Command $command * @return mixed */ public function execute(Command $command) { $this->executeDecorators($command); $handler = $this->commandTranslator->toCommandHandler($command); return $this->app->make($handler)->handle($command); }