mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
3d31f810c0
* 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
59 lines
1.0 KiB
PHP
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']);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
}
|