Model Observers getting ignored while import #3047
-
Hey there, I try to use Laravel Excel to import bulk data, but somehow having problem with event listener System Stories:
What I do:
My Problem:
UserObserver.php
EventServiceProvider.php
Import Code
Thank you |
Beta Was this translation helpful? Give feedback.
Answered by
patrickbrouwers
Mar 2, 2021
Replies: 1 comment 1 reply
-
When using batch inserts you cannot use events as eloquent is skipped and the models are inserted in 1 big query. You should either not use batch inserts if you want to send a notification per inserted row, or dispatch the notification event at the end of the import. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
sluxzer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When using batch inserts you cannot use events as eloquent is skipped and the models are inserted in 1 big query. You should either not use batch inserts if you want to send a notification per inserted row, or dispatch the notification event at the end of the import.