`Row `1` must be array` in laravel

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 Row1must 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



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

تعليقات

المشاركات الشائعة من هذه المدونة

I am unable to figure out how to create payment collection request, after a form has been submitted in laravel

laravel, mysql transaction not working after failed one time