In the boot method of the model, I have added a listener to the creating event in order to add automatically the owner id (authenticated user id) to the model.
When I want to fill the database with the factory, it doesn't work because there is no authenticated user. So the only way is to set a random user id among the users in the database.
But the code will all the way try to retrieve the authenticated user id while executing the event listener. How is it possible to use the factory without having to disable the event listener ?