Mar 21, 2019
0
Level 8
Custom file upload logic
Hey.
I have a field to a Nova project that accepts a CSV file and then runs some custom logic on that CSV file to create some relations.
The best way I've found of accomplishing this is the following:
File::make('Name of Field')->store(function (Request $request, $model) {
// Handle custom logic.
return [];
})->onlyOnForms();
This does the job but it feels awkward for me to have to return an empty array in order to prevent errors. I was just wondering if anybody else out there with a similar use case had a better approach.
Please or to participate in this conversation.