use use AppImportsDate;
to PhpOfficePhpSpreadsheetSharedDate
then it will be
namespace AppImports;
use PhpOfficePhpSpreadsheetSharedDate;
use CarbonCarbon;
use AppVouchers;
use MaatwebsiteExcelConcernsToModel;
use MaatwebsiteExcelConcernsWithHeadingRow;
use MaatwebsiteExcelConcernsWithBatchInserts;
use MaatwebsiteExcelConcernsWithChunkReading;
use MaatwebsiteExcelImportsHeadingRowFormatter;
HeadingRowFormatter::default('none');
class VouchersImport implements ToModel, WithHeadingRow, WithBatchInserts, WithChunkReading
{
/**
* @param array $row
*
* @return IlluminateDatabaseEloquentModel|null
*/
private function transformDateTime(string $value, string $format = 'Y-m-d')
{
try {
return Carbon::instance(Date::excelToDateTimeObject($value))->format($format);
}
catch (ErrorException $e)
{
return Carbon::createFromFormat($format, $value);
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…