dimanche 7 avril 2019

Import excel file use mapped cell and heading row

How can I import an excel file to database has one fied get data from a mapped cell and another field get data from a table

public function mapping(): array
{
    return [
        'Filed A val'  => 'B3',
    ];
}
use Importable;
public function model(array $row)
{
    $Obj= Table::create([
        'Filed A col' => $row['Filed A val'],
        'Filed B col' => $row['Field B val'], // this field get from a table
    ]); 
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire