get data after saving the excel file with an ID of saved #3727
-
Project in Laravel (9), and PHP (8.1). I can import a file, and save the file into the model, like this: import class:
controller:
My question is: If I can get the response of the file after saving the data, that will give me the data with the id of the row that was saved. In some cases, I will have to update a row. That's why I would like to get the ID. Now in the check and update rows section, I update by something like this: code: data will be like:
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
I try to create a function on the import class that will return the imported data. code of import class :
code of controller
|
Beta Was this translation helpful? Give feedback.
-
Can someone help me? |
Beta Was this translation helpful? Give feedback.
-
i have same issue |
Beta Was this translation helpful? Give feedback.
-
I solved my problem. this is my answer:I change the
|
Beta Was this translation helpful? Give feedback.
I solved my problem. this is my answer:
I change the
ToModel
method toToCollection
method.Because of the
foreach
inToCollection
method I can add each row to thedata
variable, and use thegetImportedData
function that returns the dataImport class: