pass result, not collect

This commit is contained in:
David Bomba 2023-10-06 22:35:54 +11:00
parent 02a85cfc5a
commit e7f04f0cf8
2 changed files with 7 additions and 9 deletions

View File

@ -85,16 +85,16 @@ class TemplateAction implements ShouldQueue
$resource->with('payments', 'client'); $resource->with('payments', 'client');
} }
$resource->withTrashed() $result = $resource->withTrashed()
->whereIn('id', $this->transformKeys($this->ids)) ->whereIn('id', $this->transformKeys($this->ids))
->where('company_id', $this->company->id); ->where('company_id', $this->company->id)
->get();
$resource->get();
if($result->count() <= 1)
if($resource->count() <= 1) $data[$key] = collect($result);
$data[$key] = [$resource];
else else
$data[$key] = $resource; $data[$key] = $result;
$pdf = $template_service->build($data)->getPdf(); $pdf = $template_service->build($data)->getPdf();

View File

@ -87,8 +87,6 @@ class InvoiceTest extends TestCase
false))->handle(); false))->handle();
} }
public function testInvoiceGetDatesBetween() public function testInvoiceGetDatesBetween()
{ {
$response = $this->withHeaders([ $response = $this->withHeaders([