Open shashankdevstree opened 2 years ago
hi do you have find any soultion for this ? please share the code with me.....
Hello @animeshs-reconnectin ,
Sad, you are also suffering from this. Actually, I uninstall this package and handle it manually. I have used the laravel queue for importing the huge CSV and maintained one different CSV for importing validation errors in it.
What I have done is I have created separate chunks of array let's say 1000 then 2 chunks of 500 records validate it using laravel standard method whatever validation errors I am getting I have dumped into validation error CSV.
Now, I set this process into the laravel queue so it will process 500 records each and append the validation errors.
Then after I checked into jobs table if there are any jobs left based on the name of the job if not then send a validation error CSV to the client that the process has been completed successfully.
Hope this helps and let me know if you need further help. thanks!
ok thank you @shashankdevstree can you please share you code it will be really helpful for me (if you have it)
sorry, but I can not share the code if you need an idea I can help you with that.
@shashankdevstree its ok thanks
I am using ShouldQueue method to have the large CSV into Queue but the errors of validations I am not able to catch them!
public function registerEvents(): array { return [ ImportFailed::class => function(ImportFailed $event) { dd($event); // This I will write into the FILE or send EMAIL but the job runs successfully but validation errors keep empty. $this->importedBy->notify(new ImportHasFailedNotification); }, ]; }
My code looks like below...
public function registerEvents(): array { return [ ImportFailed::class => function(ImportFailed $event) { $filename = public_path('tmp').'/validation_error.txt'; $myfile = fopen($filename, "w"); fwrite($myfile, "domo"); fclose($myfile); }, ]; }
I am in hope that if there is any error validation_error.txt file will have "Demo" inside it.
I just wanted to add those errors in a file and email to the user that's it.
Also, I have crossed verify by removing ShouldQueue it gives me proper errors for email already exists a kind of.
Please help if you have any ideas! Thanks!