lundi 22 juin 2020

Laravel import Seller_id from Excel File

I'm building multi Shops Platform, So i'm able to manage shop's products from admin panel

i'm using this package to import products from excel file to specific Shop, and i've Shop_id in Products Table

Now, I'm able to import excel file to database successfully. But, The problem is to assign Shop_id in for each product

Any Ideas to do that ?

PruductImport.php

public function model(array $row)
    {
        return new Product([
            'name'         => $row['Name'],
            'price'        => $row['Price'],
        ]);
    } 

Controller

public function import(Request $request)
    {
        Excel::import(new PruductImport,request()->file('file'));

        return back()->with('success','Done!');
    }


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

Aucun commentaire:

Enregistrer un commentaire