jeudi 7 mars 2019

Laravel 5.7: Why do my model create() and save() methods create 2 records when called?

I am using mysql DB, Laravel 5.7, on Apache.

I already have a full system running, and all seems to be fine, except...I decided to start using some eloquent factories for testing, and noticed that the factories were making 2 entries in mysql when I save/create a model. So I simplified, and created my own "makeFake" method, and find that its doing the same thing. I don't know what I have done wrong. Or maybe there is some area of the framework that I do not fully understand.

Main question: Why do my model create() and save() methods create 2 records when called?

Simplified case below... (in this case, I am calling 2 methods to create a company, but I am getting 4 company records)

From my web.php enter image description here

From my Company.php model (I already loaded faker and GUID libraries) enter image description here



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire