added limit to import

This commit is contained in:
Denis Duliçi
2021-06-27 03:27:19 +03:00
parent c78519cc2e
commit cbf2314dec
5 changed files with 24 additions and 6 deletions

View File

@ -15,11 +15,12 @@ use Maatwebsite\Excel\Concerns\SkipsEmptyRows;
use Maatwebsite\Excel\Concerns\ToModel;
use Maatwebsite\Excel\Concerns\WithChunkReading;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
use Maatwebsite\Excel\Concerns\WithLimit;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Concerns\WithValidation;
use PhpOffice\PhpSpreadsheet\Shared\Date as ExcelDate;
abstract class Import implements HasLocalePreference, ShouldQueue, SkipsEmptyRows, WithChunkReading, WithHeadingRow, WithMapping, WithValidation, ToModel
abstract class Import implements HasLocalePreference, ShouldQueue, SkipsEmptyRows, WithChunkReading, WithHeadingRow, WithLimit, WithMapping, WithValidation, ToModel
{
use Importable, ImportHelper;
@ -69,7 +70,12 @@ abstract class Import implements HasLocalePreference, ShouldQueue, SkipsEmptyRow
public function chunkSize(): int
{
return 100;
return config('excel.imports.chunk_size');
}
public function limit(): int
{
return config('excel.imports.row_limit');
}
public function isNotValid($row)