1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00
invoiceninja/app/Providers/MultiDBProvider.php
David Bomba 3d31f810c0
Set Invitations as a default include for invoices (#3362)
* Working on importing company gateways

* Fix for companyuser settings object

* Migrate client_gateway_tokens

* Working on Notificaitons

* Working on notifications

* Failsafe for user-company

* unlink files

* Set DB for jobs

* Always have a fallback for company_id

* Fixes for user model

* Formatting for MultiDB

* Working on Company Ledger Tests

* Fixes for contact request

* Set Invitations as a default include for invoices
2020-02-24 21:15:30 +11:00

59 lines
1.0 KiB
PHP

<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Providers;
use App\Libraries\MultiDB;
use Illuminate\Support\ServiceProvider;
class MultiDBProvider extends ServiceProvider
{
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
}
/**
* Register services.
*
* @return void
*/
public function register()
{
if($this->app->runningInConsole()){
return;
}
$this->app['events']->listen(\Illuminate\Queue\Events\JobProcessing::class, function($event) {
if (isset($event->job->payload()['db'])) {
//\Log::error("Provider Setting DB = ".$event->job->payload()['db']);
MultiDB::setDb($event->job->payload()['db']);
}
}
);
}
}