1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Merge pull request #6392 from turbo124/v5-develop

Set DB for live previews
This commit is contained in:
David Bomba 2021-08-05 19:52:52 +10:00 committed by GitHub
commit 561de51dd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -170,7 +170,7 @@ class PreviewController extends BaseController
public function live(PreviewInvoiceRequest $request)
{
MultiDB::setDb(auth()->user()->company()->db);
if($request->input('entity') == 'invoice'){
$repo = new InvoiceRepository();
$factory = InvoiceFactory::create(auth()->user()->company()->id, auth()->user()->id);
@ -200,7 +200,7 @@ class PreviewController extends BaseController
if($request->has('entity_id')){
$entity_obj = $class::withTrashed()->whereId($this->decodePrimaryKey($request->input('entity_id')))->company()->first();
$entity_obj = $class::on(auth()->user()->company()->db)->withTrashed()->whereId($this->decodePrimaryKey($request->input('entity_id')))->company()->first();
$entity_obj = $repo->save($request->all(), $entity_obj);
}