54 lines
1.1 KiB
PHP
54 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Imports;
|
|
use Illuminate\Support\Facades\Hash;
|
|
use App\Models\Cuentas;
|
|
use Maatwebsite\Excel\Concerns\ToModel;
|
|
|
|
class UsersImport implements ToModel
|
|
{
|
|
/**
|
|
* @param array $row
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Model|null
|
|
*/
|
|
public function model(array $row)
|
|
{
|
|
//dd($row);
|
|
return new Cuentas([
|
|
|
|
'correo'=> $row[0],
|
|
'password'=> $row[1],
|
|
'estado'=> $row[2],
|
|
'inicio'=> \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[3]),
|
|
'vencimiento'=> \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[4]),
|
|
'servicio_id'=> $row[5],
|
|
|
|
]);
|
|
|
|
}
|
|
public function headingRow(): int
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
public function batchSize(): int
|
|
{
|
|
return 1000;
|
|
}
|
|
|
|
public function chunkSize(): int
|
|
{
|
|
return 1000;
|
|
}
|
|
|
|
public function getDateFormats(): array
|
|
{
|
|
return [
|
|
|
|
'Y-m-d',
|
|
|
|
];
|
|
}
|
|
}
|