How to resolve the error - Call to a member function hasFile () on array

0

I'm using the Maatwebsite library to import csv into my database;

public function importExcel($request){

    if($request->hasFile('import_file')){

        Excel::load($request->file('import_file')->getRealPath(), function ($reader) {

            dd($request);

            foreach ($reader->toArray() as $key => $row) {
                $data['title'] = $row['title'];
                $data['description'] = $row['description'];

                if(!empty($data)) {

                    $this->order->create($data);    
                   // DB::table('order_main')->insert($data);
                }
            }
        });
    }
}

Debug error Laravel="Call to a member function hasFile () on array"

    
asked by anonymous 26.06.2018 / 15:32

0 answers