Jan 15, 2016
0
Level 1
Different Bus Provider not working
Hi,
Trying to use a different Bus provider for my application by doing the following:
bootstrap/app.php
<?php
// ...
/*
|--------------------------------------------------------------------------
| Register Service Providers
|--------------------------------------------------------------------------
|
| Here we will register all of the application's service providers which
| are used to bind services into the container. Service providers are
| totally optional, so you are not required to uncomment this line.
|
*/
$app->register(App\Providers\AppServiceProvider::class);
$app->register(App\Providers\BusServiceProvider::class);
app/Providers/BusServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class BusServiceProvider extends ServiceProvider
{
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app->bind('Illuminate\Contracts\Bus\Dispatcher', function ($app) {
return new \AltThree\Bus\Dispatcher($app);
});
}
}
But whenever I inject Illuminate\Contracts\Bus\Dispatcher, I get an instance of Illuminate\Bus\Dispatcher which obviously isn't the right one.
Does anyone know where I'm going wrong?
Thanks!
Please or to participate in this conversation.