In the app's exports, I've added InterfaceSupplier (as UplSupplierImport). I'm having a problem with "Array to string conversion" once more. This is the new InterfaceSupplier that I've added to my app/export under the name UplSupplierImport. Because the new code for the controller was the same as your previous code:
class InterfaceSupplier implements ToArray
{
public function array(array $row)
{
return [
'nomorUrut' => $row[0],
'namaSupplier' => $row[1],
'singkatanSupplier' => $row[2],
'tipeSupplier' => $row[3],
'alamatSupplier' => $row[4],
'kodePosSupplier' => $row[5],
'noTelpSupplier' => $row[6],
'noFax' => $row[7],
'emailSupplier' => $row[8],
'contakSupplier' => $row[9],
'hp' => $row[10],
];
}
}
and this the controller code:
public function postImport(Request $request)
{
$path = $request->file('file')->getRealPath();
$insert_data = Excel::toArray(new InterfaceSupplier(), $path);
if(!empty($insert_data))
{
DB::table('uplSupplier')->insert($insert_data);
}
return back()->with('success', 'Excel Data Imported successfully.');
}