I need to export a sheet with a complex heading via Laravel Excel. I need a main heading and another sub-level heading after.
I'm trying like this,
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\WithHeadings;
class InvoicesExport implements FromQuery, WithHeadings
{
public function headings(): array
{
return [
'Account 1' =>[
"Account 1 id",
"Account 1 branch"
],
'Account 2' =>[
"Account 2 id",
"Account 2 branch"
],
];
}
}
But getting header columns like, [ "Account 1 id", "Account 1 branch" ]
is there a way to archive this task?