mirror of
https://github.com/flarum/framework.git
synced 2024-12-12 14:13:37 +08:00
One BusServiceProvider is enough
This commit is contained in:
parent
2d4802d637
commit
98aaa6a130
|
@ -12,17 +12,27 @@
|
||||||
namespace Flarum\Bus;
|
namespace Flarum\Bus;
|
||||||
|
|
||||||
use Flarum\Foundation\AbstractServiceProvider;
|
use Flarum\Foundation\AbstractServiceProvider;
|
||||||
use Illuminate\Contracts\Bus\Dispatcher as BusContract;
|
use Illuminate\Bus\Dispatcher as BaseDispatcher;
|
||||||
|
use Illuminate\Contracts\Bus\Dispatcher as DispatcherContract;
|
||||||
|
use Illuminate\Contracts\Bus\QueueingDispatcher as QueueingDispatcherContract;
|
||||||
use Illuminate\Contracts\Queue\Factory as QueueFactoryContract;
|
use Illuminate\Contracts\Queue\Factory as QueueFactoryContract;
|
||||||
|
|
||||||
class BusServiceProvider extends AbstractServiceProvider
|
class BusServiceProvider extends AbstractServiceProvider
|
||||||
{
|
{
|
||||||
public function register()
|
public function register()
|
||||||
{
|
{
|
||||||
$this->app->bind(BusContract::class, function ($app) {
|
$this->app->bind(BaseDispatcher::class, function ($app) {
|
||||||
return new Dispatcher($app, function ($connection = null) use ($app) {
|
return new Dispatcher($app, function ($connection = null) use ($app) {
|
||||||
return $app[QueueFactoryContract::class]->connection($connection);
|
return $app[QueueFactoryContract::class]->connection($connection);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$this->app->alias(
|
||||||
|
BaseDispatcher::class, DispatcherContract::class
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->app->alias(
|
||||||
|
BaseDispatcher::class, QueueingDispatcherContract::class
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace Flarum\Foundation;
|
||||||
|
|
||||||
use Flarum\Admin\AdminServiceProvider;
|
use Flarum\Admin\AdminServiceProvider;
|
||||||
use Flarum\Api\ApiServiceProvider;
|
use Flarum\Api\ApiServiceProvider;
|
||||||
use Flarum\Bus\BusServiceProvider as BusProvider;
|
use Flarum\Bus\BusServiceProvider;
|
||||||
use Flarum\Database\DatabaseServiceProvider;
|
use Flarum\Database\DatabaseServiceProvider;
|
||||||
use Flarum\Database\MigrationServiceProvider;
|
use Flarum\Database\MigrationServiceProvider;
|
||||||
use Flarum\Discussion\DiscussionServiceProvider;
|
use Flarum\Discussion\DiscussionServiceProvider;
|
||||||
|
@ -125,8 +125,6 @@ class InstalledSite implements SiteInterface
|
||||||
$laravel->register(ViewServiceProvider::class);
|
$laravel->register(ViewServiceProvider::class);
|
||||||
$laravel->register(ValidationServiceProvider::class);
|
$laravel->register(ValidationServiceProvider::class);
|
||||||
|
|
||||||
$laravel->register(BusProvider::class);
|
|
||||||
|
|
||||||
$settings = $laravel->make(SettingsRepositoryInterface::class);
|
$settings = $laravel->make(SettingsRepositoryInterface::class);
|
||||||
|
|
||||||
$config->set('mail.driver', $settings->get('mail_driver'));
|
$config->set('mail.driver', $settings->get('mail_driver'));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user