I get this error in Laravel when wanting to import an excel document into my database in mysql the code is as follows:
public function store(ImportadorMarceloRequest $request)
{
//
$path = $request->file('archivo')->storeAs('uploads/importaciones', $request->file('archivo')->getClientOriginalName(), 'web');
$filePath = public_path() .'/'.$path;
Excel::load($filePath, function($reader) use ($request){
$objExcel = $reader->getExcel();
$sheet = $objExcel->getSheet(0);
DB::transaction(function(){
foreach ($sheet->toArray() as $key => $row) {
if ($key >= 3) {
try {
$inmueble = Inmueble::where('id_unico', $row[1])
->where('promocion', $row[2])
->where('id_prinex', $row[3])->first();
if ($inmueble == null) {
$inmueble = new Inmueble();
}
$inmueble->fecha_datos = empty(trim($row[0])) ? null : $row[0];
$inmueble->id_unico = empty(trim($row[1])) ? null : $row[1];