diff --git a/app/Services/Template/TemplateAction.php b/app/Services/Template/TemplateAction.php index b8cce0f74809..80f0a3351e12 100644 --- a/app/Services/Template/TemplateAction.php +++ b/app/Services/Template/TemplateAction.php @@ -85,16 +85,16 @@ class TemplateAction implements ShouldQueue $resource->with('payments', 'client'); } - $resource->withTrashed() + $result = $resource->withTrashed() ->whereIn('id', $this->transformKeys($this->ids)) - ->where('company_id', $this->company->id); + ->where('company_id', $this->company->id) + ->get(); - $resource->get(); - - if($resource->count() <= 1) - $data[$key] = [$resource]; + + if($result->count() <= 1) + $data[$key] = collect($result); else - $data[$key] = $resource; + $data[$key] = $result; $pdf = $template_service->build($data)->getPdf(); diff --git a/tests/Feature/InvoiceTest.php b/tests/Feature/InvoiceTest.php index e54c6c2e2580..a97515484ce1 100644 --- a/tests/Feature/InvoiceTest.php +++ b/tests/Feature/InvoiceTest.php @@ -87,8 +87,6 @@ class InvoiceTest extends TestCase false))->handle(); } - - public function testInvoiceGetDatesBetween() { $response = $this->withHeaders([