lundi 26 mars 2018

Call to undefined method Maatwebsite\Excel\Excel::load()

I'm trying to import excel file (.xlsx) using maatwebsite 3.0. How to fix This error

Call to undefined method Maatwebsite\Excel\Excel::load()

My controller

public function importsave(Request $request)
{
   if($request->hasFile('excel'))
    {
        $path = $request->file('excel')->getRealPath();
        $data= Excel::load($path, function($reader) {})->get();
        if(!empty($data) && $data->count())
        {
            foreach($data->toArray() as $key=>$value)
            {
                if(!empty($value))
                {
                    Employee::insert($value);
                }
            }
        }
    }
}



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2GtDHzY
via IFTTT

1 commentaire:

  1. Hi there in version 3 the load method was remove so switch back to version two like so composer require "maatwebsite/excel:~2.1.0"

    RépondreSupprimer