T
T
tirali2019-02-14 20:20:06
Laravel
tirali, 2019-02-14 20:20:06

Bug in Laravel or am I stupid?

I do multiple insert:

Model::insertGetId();

Then an error comes up:

Illuminate/Database/QueryException with message 'PHP Notice: Array to string conversion in /vendor/laravel/framework/src/Illuminate/Database/MySqlConnection.php on line 80 (SQL: insert into `models` (`name`) values ​​( 12))'

PHP 7.3.1. What the hell? It seems that this method accepts an array, which means it should show a lot of IDs. Do you get such an error?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
JhaoDa, 2019-02-14
@tirali

insertGetIddoes not know how to insert multiple, only insert. what id should it return if 10 records are inserted?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question