samedi 16 février 2019

how to store images from excel sheet in laravel 5

i'm using this library to upload excel files and store the data from excel to database .. and i want to store images from excel to storage but not succeed .. this is my code

 public function addExcel(Request $request)
{
    $request->validate([
'file' => 'required'
    ]);
     Excel::load($request->file('file')->getRealPath(), function ($reader) {
         foreach ($reader->toArray() as $key => $row) {
                $data['model_name'] = $row['model_name'];
                $data['part_number'] = $row['part_number'];


                if(!empty($data)) {
                    DB::table('products')->insert($data);
                }
            }
     });
     return 'done';
}

and this is my excel



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2IhL7bV
via IFTTT

Aucun commentaire:

Enregistrer un commentaire