/**
  * Bootstrap any application services.
  *
  * @param  \Illuminate\Bus\Dispatcher  $dispatcher
  * @return void
  */
 public function boot(Dispatcher $dispatcher)
 {
     $dispatcher->mapUsing(function ($command) {
         return Dispatcher::simpleMapping($command, 'App\\Commands', 'App\\Handlers\\Commands');
     });
 }
 /**
  * Register a fallback mapper callback.
  *
  * @param \Closure $mapper
  * @return void 
  * @static 
  */
 public static function mapUsing($mapper)
 {
     \Collective\Bus\Dispatcher::mapUsing($mapper);
 }
예제 #3
0
 public function testDispatchShouldCallAfterResolvingIfCommandNotQueued()
 {
     $container = new Container();
     $handler = m::mock('StdClass')->shouldIgnoreMissing();
     $handler->shouldReceive('after')->once();
     $container->instance('Handler', $handler);
     $dispatcher = new Dispatcher($container);
     $dispatcher->mapUsing(function () {
         return 'Handler@handle';
     });
     $dispatcher->dispatch(new BusDispatcherTestBasicCommand(), function ($handler) {
         $handler->after();
     });
 }
예제 #4
0
 /**
  * Boot the service provider.
  *
  * @param \Collective\Bus\Dispatcher $dispatcher
  */
 public function boot(Dispatcher $dispatcher)
 {
     $dispatcher->mapUsing(function ($command) {
         return Dispatcher::simpleMapping($command, 'Gitamin', 'Gitamin\\Handlers');
     });
 }