I'm trying to insert users using csv. My model has an observer on "created" event.
However I can have a bug after some $users->save() because of code in my function created event (which I fixed).
The code in created event send an email to the user. The problem is if code crash after 5iterations, I got my 5emails send but no user in my db.
I'm wondering if Eloquent use transaction when you call multiple times save() ? If yes how to force Eloquent to really save my object after each end of event created ?
May be I'm misunderstanding something with event, because I don't see the point of using this event if your not sure to have your model insert in your DB.
Finally found what was wrong...
To insert csv my project use : https://github.com/Maatwebsite/Laravel-Excel
And after some research, this is "why" eloquent use transaction in my case : https://docs.laravel-excel.com/3.1/imports/validation.html#database-transactions