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"