I am using laravel 5.4 I want to get the record identifiers after I insert them into the table. here the data i want to insert is stored in an array
$data = [
[
"count" => "100",
"start_date" => 1515628800
],
[
"count" => "102",
"start_date" => 1515715200
]
];
here I immediately insert an array of elements
\Auth::user()->schedule()->insert($data);
but this method returns boolean
, and I want to get the identifiers (or all columns) of these new elements after they are inserted, how can I do this? it doesn't matter if this is done with eloquent
or querybuilder
. I already tried the method insertGetId
, but it does not work with a multidimensional array. if this is not possible with laravel, what would be the best way to implement this?
source
share