Im have small problem I need to import to DB a Excel file with a lot of information In my Excel file im have row with date format like this YYYY-MM-DD When import complete Instead of this date format YYYY-MM-DD im get a value of random numbers I tried to changed type of row in DB, Encoding of DB but this is not help MB somebody know what im do wrong This is my code from import file
public function model(array $row)
{
return new ImportPassportCounter([
'OS_RAH' => $row[0],
'N_MARK' => $row[1],
'ZAV_NOMER' => $row[2],
'DIAM' => $row[3],
'N_MISK' => $row[4],
'DATA_VST' => \DateTime::createFromFormat('Y-m-d', "$row[5]"),
'DATA_POV' => $row[6],
'DATA_NAST_POV' => $row[7],
'KIL_MISIAC' => $row[8],
'POP_POK' => $row[9],
'OST_POK' => $row[10],
'TIP' => $row[11],
'KON_POK' => $row[12],
'DATA_KON_POK' => $row[13],
'DATA_N_PLOMB' => $row[14],
'N_PLOMB' => $row[15],
]);
}
And this is my migration file
Schema::create('import_passport_counters', function (Blueprint $table) {
$table->id();
$table->string('OS_RAH')->nullable();
$table->string('N_MARK')->nullable();
$table->string('ZAV_NOMER')->nullable();
$table->string('DIAM')->nullable();
$table->string('N_MISK')->nullable();
$table->text('DATA_VST')->nullable();
$table->text('DATA_POV')->nullable();
$table->text('DATA_NAST_POV')->nullable();
$table->string('KIL_MISIAC')->nullable();
$table->string('POP_POK')->nullable();
$table->string('OST_POK')->nullable();
$table->string('TIP')->nullable();
$table->string('KON_POK')->nullable();
$table->text('DATA_KON_POK')->nullable();
$table->text('DATA_N_PLOMB')->nullable();
$table->string('N_PLOMB')->nullable();
$table->timestamps();
});
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3g4dBm6
via IFTTT
Aucun commentaire:
Enregistrer un commentaire