Ejemplo n.º 1
0
 public function boot(Dispatcher $dispatcher)
 {
     $dispatcher->mapUsing(function ($command) {
         $command = str_replace('Commands\\', 'Commands\\Handlers\\', get_class($command));
         return trim($command, '\\') . 'Handler@handle';
     });
     $this->registerMiddleware($this->app['router']);
     $this->registerModuleResourceNamespaces();
     $this->setLocalesConfigurations();
 }
 /**
  * Handle the command.
  */
 public function handle(Dispatcher $bus)
 {
     /**
      * Customize command to handler mapping.
      */
     $bus->mapUsing(function ($command) {
         /**
          * If the command is self handling then
          * return the handle method as defined
          * by the interface.
          */
         if ($command instanceof SelfHandling) {
             return get_class($command) . '@handle';
         }
         // Handlers are in the same directory.
         return get_class($command) . 'Handler@handle';
     });
 }