I want to show three tables, three tables are later to be exported, but I am having a problem here, please help me resolve my problem. Thank you.
public function downloadExcel($type)
{
$data = DB::table('tb_siswa')
->join('tb_ayah', 'tb_siswa.id', '=', 'tb_ayah.id_siswa')
->join('tb_ibu', 'tb_siswa.id', '=', 'tb_ibu.id_siswa')
->select('tb_siswa.nm_lengkap', 'tb_ayah.nm_ayah', 'tb_ibu.nm_ibu')
->get();
return Excel::create('Data siswa', function($excel) use ($data) {
$excel->sheet('datasiswa', function($sheet) use ($data)
{
$sheet->fromArray($data);
});
})->download($type);
}
Add this line before return function
$data= json_decode( json_encode($data), true);
Hope it helps!