Untitled
unknown
plain_text
2 years ago
1.0 kB
8
Indexable
public function uploadExcel(Request $request)
{
// Excel::import(new MypesImport, $request->file('file')->store('temp'));
// Excel::queueImport(new MypesImport, $request->file('file')->store('temp'));
try {
// Excel::import(
// new QueuedImport,
// $request->file('file')->store('temp')
// );
(new QueuedImport)->import($request->file('file')->store('temp'), null, \Maatwebsite\Excel\Excel::XLSX);
} catch (\Maatwebsite\Excel\Validators\ValidationException $e) {
$failures = $e->failures();
foreach ($failures as $failure) {
$failure->row(); // row that went wrong
$failure->attribute(); // either heading key (if using heading row concern) or column index
$failure->errors(); // Actual error messages from Laravel validator
$failure->values(); // The values of the row that has failed.
}
}
}Editor is loading...
Leave a Comment