Import Action
Nothing is being imported and the job fails when I do queue:work. I am not being able to dd in any functions in the importer as well to know where it went wrong. It is just continuously failing only !!!
Solution:Jump to solution
I got it. I sent the required value in the options where I call the importer.
15 Replies
Did you check the failed_jobs table?
yes but there is no error, just datas only
also it is trying to upload all the values in the csv instead of just the ones that I have asked
I don't know what I have missed
Been through this a lot today 😛 it's failing because of your resolveRecord using I suspect.
Check your laravel.log
it is failing due to my database requirements. but I could not figure out how can I pass the data that is not in the csv while uploading.
Several ways, castUsing or fillRecordWith within the individual fields. If you need to pass in more data outside of the scope you can manipluate the data in the fillRecordUsing
i.e.
Is there any way to pass data in the import from where it is being used ? Like I have userimporter but I have this in program model and I need to pass a specific organization id in the importer itself. Is it possible ?
so will the oranization id be in the importer? Can you clarify the exact flow?
I have a resource called organization resource whose edit organization has the importer. The importer fills or uploads the data in another resource called invitations which has organization id. The importer doesn’t have the organization id.
So now I have to pass the selected organization id to the importer at the time of uploading it
Solution
I got it. I sent the required value in the options where I call the importer.
Hi, I'm trying to import a CSV file that contains Employee, Payment and Detail data,
I've been trying to do this the following way, but I always get the error:
However, the 'dni' field (which is the first in ImportColum), is in the Employee model and it seems that it wants to insert it into Payment,
any suggestions? I also tried with the hooks and it gives me the same result, my current code is:
I hope you can give me some ideas, thanks.
Can you explain in which database are you trying to write the import values ? In employee or payment ?
Traducción al inglés:
Hi, thanks for replying. In the CSV, I have information for both tables, Employee and Payment.
I wanted to first register the employee data with
, and then register their payments with $payment = $this->createOrUpdatePayment($employee);
Each row in the CSV has this information.
In summary, I need to insert into both tables for each row that is processed.
If you need to insert in the both tables all the rows in the csv then dni must also be in payment. Since it looks like you are trying to upload all the data in the both fields