dimanche 1 avril 2018

Eloquent error in bulk entry insert

I will try to explain a problem shortly. I was having problem inserting data into database, all were working except data were not sitting in right columns. And this is what I have observed. Problem was I mistyped column name in array ($data_gl_table) but this did not throw an error.

Here is structure of an array:

$data_gl_table = [
     [0] => [...],
     [1] => [...],
     [2] => [...],
     ...
]

When I do below, colmns get messed up and no error.

gl_table::insert($row);

Gives an error when column name misspelled.

> foreach($data_gl_table as $row) {
>          gl_table::insert($row);
>}

Problem is why first method do not throw the error ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire