Skip to content

Commit 78b9126

Browse files
committed
Allow lazy collection
1 parent 7f484d5 commit 78b9126

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/Exports/DataTablesCollectionExport.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Yajra\DataTables\Exports;
44

55
use Illuminate\Support\Collection;
6+
use Illuminate\Support\LazyCollection;
67
use Maatwebsite\Excel\Concerns\Exportable;
78
use Maatwebsite\Excel\Concerns\FromCollection;
89
use Maatwebsite\Excel\Concerns\WithHeadings;
@@ -12,22 +13,22 @@ abstract class DataTablesCollectionExport implements FromCollection, WithHeading
1213
use Exportable;
1314

1415
/**
15-
* @var Collection
16+
* @var Collection|LazyCollection
1617
*/
17-
protected Collection $collection;
18+
protected $collection;
1819

1920
/**
20-
* @param \Illuminate\Support\Collection|null $collection
21+
* @param Collection|LazyCollection|null $collection
2122
*/
22-
public function __construct(Collection $collection = null)
23+
public function __construct($collection = null)
2324
{
2425
$this->collection = $collection ?? new Collection;
2526
}
2627

2728
/**
28-
* @return Collection
29+
* @return Collection|LazyCollection
2930
*/
30-
public function collection(): Collection
31+
public function collection()
3132
{
3233
return $this->collection;
3334
}

0 commit comments

Comments
 (0)