Try this to see the exception
} catch (\Throwable $th) {
dd($th);
}
Dear Developers,
I am getting 302 status code for following code
try {
$this->validate($request, [
'select_file' => 'required|mimes:xls,xlsx'
]);
$path = $request->file('select_file')->getRealPath();
$collections = fastexcel()->import($path);
foreach ($collections as $collection) {
//Exam::create($collection);
$exam = new Exam();
$exam->student_id = $collection['student_id'];
$exam->teacher_id = $request->input('teacher_id');
$exam->subject_name = $collection['subject_name'];
$exam->mark = $collection['mark'];
$exam->save();
}
return back()->with('success', 'Excel Data Imported successfully.');
} catch (\Throwable $th) {
return back();
}
But If I use same code without try catch my Excel file uploads Successfully. I would like to want not to see any error at user interface thank you . Or Please give me any solution how to avoid any any laravel given error to hide and provide custome error instead it.
Please or to participate in this conversation.