mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-06 03:24:35 -04:00
Multi-db support
This commit is contained in:
parent
80c6d68647
commit
2d6fcb4e39
@ -88,10 +88,10 @@ class CheckData extends Command
|
||||
$this->info($this->log);
|
||||
|
||||
if ($errorEmail) {
|
||||
Mail::raw($this->log, function ($message) use ($errorEmail) {
|
||||
Mail::raw($this->log, function ($message) use ($errorEmail, $database) {
|
||||
$message->to($errorEmail)
|
||||
->from(CONTACT_EMAIL)
|
||||
->subject('Check-Data: ' . strtoupper($this->isValid ? RESULT_SUCCESS : RESULT_FAILURE));
|
||||
->subject("Check-Data [{$database}]: " . strtoupper($this->isValid ? RESULT_SUCCESS : RESULT_FAILURE));
|
||||
});
|
||||
} elseif (! $this->isValid) {
|
||||
throw new Exception('Check data failed!!');
|
||||
|
@ -87,10 +87,10 @@ class SendReminders extends Command
|
||||
$this->info('Done');
|
||||
|
||||
if ($errorEmail = env('ERROR_EMAIL')) {
|
||||
\Mail::raw('EOM', function ($message) use ($errorEmail) {
|
||||
\Mail::raw('EOM', function ($message) use ($errorEmail, $database) {
|
||||
$message->to($errorEmail)
|
||||
->from(CONTACT_EMAIL)
|
||||
->subject('SendReminders: Finished successfully');
|
||||
->subject("SendReminders [{$database}]: Finished successfully");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -107,10 +107,10 @@ class SendRenewalInvoices extends Command
|
||||
$this->info('Done');
|
||||
|
||||
if ($errorEmail = env('ERROR_EMAIL')) {
|
||||
\Mail::raw('EOM', function ($message) use ($errorEmail) {
|
||||
\Mail::raw('EOM', function ($message) use ($errorEmail, $database) {
|
||||
$message->to($errorEmail)
|
||||
->from(CONTACT_EMAIL)
|
||||
->subject('SendRenewalInvoices: Finished successfully');
|
||||
->subject("SendRenewalInvoices [{$database}]: Finished successfully");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -291,7 +291,6 @@ if (! defined('APP_NAME')) {
|
||||
define('EVENT_DELETE_INVOICE', 9);
|
||||
|
||||
define('REQUESTED_PRO_PLAN', 'REQUESTED_PRO_PLAN');
|
||||
define('DEMO_ACCOUNT_ID', 'DEMO_ACCOUNT_ID');
|
||||
define('NINJA_ACCOUNT_KEY', env('NINJA_ACCOUNT_KEY', 'zg4ylmzDkdkPOT8yoKQw9LTWaoZJx79h'));
|
||||
define('NINJA_ACCOUNT_EMAIL', env('NINJA_ACCOUNT_EMAIL', 'contact@invoiceninja.com'));
|
||||
define('NINJA_LICENSE_ACCOUNT_KEY', 'AsFmBAeLXF0IKf7tmi0eiyZfmWW9hxMT');
|
||||
|
@ -97,25 +97,6 @@ class AccountController extends BaseController
|
||||
$this->paymentService = $paymentService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function demo()
|
||||
{
|
||||
$demoAccountId = Utils::getDemoAccountId();
|
||||
|
||||
if (! $demoAccountId) {
|
||||
return Redirect::to('/');
|
||||
}
|
||||
|
||||
$account = Account::find($demoAccountId);
|
||||
$user = $account->users()->first();
|
||||
|
||||
Auth::login($user, true);
|
||||
|
||||
return Redirect::to('invoices/create');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
|
@ -4,6 +4,7 @@ namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Closure;
|
||||
use App\Models\LookupAccount;
|
||||
use App\Models\LookupContact;
|
||||
use App\Models\LookupInvitation;
|
||||
use App\Models\LookupAccountToken;
|
||||
@ -37,6 +38,10 @@ class DatabaseLookup
|
||||
}
|
||||
} elseif ($guard == 'postmark') {
|
||||
LookupInvitation::setServerByField('message_id', request()->MessageID);
|
||||
} elseif ($guard == 'account') {
|
||||
if ($key = request()->account_key) {
|
||||
LookupAccount::setServerByField('account_key', $key);
|
||||
}
|
||||
} elseif ($guard == 'license') {
|
||||
config(['database.default' => DB_NINJA_1]);
|
||||
}
|
||||
|
@ -83,7 +83,10 @@ Route::group(['middleware' => 'lookup:postmark'], function () {
|
||||
Route::post('/hook/email_opened', 'AppController@emailOpened');
|
||||
});
|
||||
|
||||
Route::post('/payment_hook/{accountKey}/{gatewayId}', 'OnlinePaymentController@handlePaymentWebhook');
|
||||
Route::group(['middleware' => 'lookup:account'], function () {
|
||||
Route::post('/payment_hook/{account_key}/{gateway_id}', 'OnlinePaymentController@handlePaymentWebhook');
|
||||
}
|
||||
|
||||
//Route::post('/hook/bot/{platform?}', 'BotController@handleMessage');
|
||||
|
||||
// Laravel auth routes
|
||||
@ -117,7 +120,6 @@ Route::group(['middleware' => ['lookup:contact']], function () {
|
||||
if (Utils::isNinja()) {
|
||||
Route::post('/signup/register', 'AccountController@doRegister');
|
||||
Route::get('/news_feed/{user_type}/{version}/', 'HomeController@newsFeed');
|
||||
Route::get('/demo', 'AccountController@demo');
|
||||
}
|
||||
|
||||
if (Utils::isReseller()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user