Initial commit
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?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',
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user