I am trying to import csv file in laravel with help of maatwebsite . I have query which is bringing data from two table both have relation with each other. it is exporting only one table data when I try to fetch data of both tables it gives me an error of Row
1must be array
$data = SaleOrder::where('id',$id)->with('customers')->get()->toArray();
return Excel::create('Packlist Sale Order '.$id, function($excel) use ($data) {
$excel->sheet('mySheet', function($sheet) use ($data)
{
foreach($data as $customer)
{
$sheet->fromArray($customer['customers']);
}
$sheet->fromArray($data);
});
})->download('xlsx');
I want fetch data of both tables in csv file
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire