Replies: 1 comment
-
answer here : #2889 (comment) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
answer here : #2889 (comment) |
Beta Was this translation helpful? Give feedback.
-
I want to catch errors when use should Queue to store it in my database without any skip and if there is any error run ImportFailed event
this is my code : rule method =>
public function rules(): array { return [ '*.item_code' => ['required', 'distinct'], '*.price' => 'required|numeric', '*.qty' => 'required|numeric', '*.discount' => 'required|numeric', '*.total_price_before_discount' => 'required|numeric', ]; }
onFailure works good but i want if there is any error make import faild and donot compelete
this is onFailure method :
public function onFailure(Failure ...$failures) { foreach ($failures as $failure) { $errors[] = ['row' => $failure->row(), 'attribute' => $failure->attribute(), 'errors' => $failure->errors()]; } // another logic here }
and i use ToArray for import like this :
public function array(array $array) { //my import logic here }
Beta Was this translation helpful? Give feedback.
All reactions