I need to import datas from a CSV given by the client.
I cant import raw datas, I need to do some operation before importing, for example saving a relation between a product and a category whereas the category in the CSV is an integer (so I need to search for the corresponding category, and save it as a relation to the product I import).
So be simple, I need the power of PHP / laravel to manipulate my datas before creating the corresponding tailor models, how can I do that ?
@artistro08 but this method will also be triggered when you add a new model using the backend isn’t it ? I’m not sure if I have the necessary conditions to check if the model is created using an import or using the backend form
@daft
I finally created a “true” plugin to handle import exactly as I want, but it’s true that some hooks to be able to modify the $data array before importing model would be a great addition to tailor.
I also need to run custom code when using the import functionality of the backend forms (JSON or CSV files). It would be very useful if you share some sample code. For instance, if using the beforeSave event, how to check if it is an import operation and not a normal record edit? How to identify the content type?