Were you able to solve this?
EDIT: in case anyone need it, this was the only solution that worked for me
https://github.com/SpartnerNL/Laravel-Excel/discussions/3283#discussioncomment-1455271
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi Everyone! I was able to export the excel and to add the images but for some reason he dosent put the images aligned with the records. Some one can help me plz ?
public function collection()
{
$data = Citation::where('user_id', auth()->id())->get();
foreach($data as $citation)
{
$citations[] = array(
'title' => $citation->title,
'source' => $citation->source->name,
'description' => $citation->description,
'author' => $citation->authors,
'page_number' =>$citation->page_number,
'publisher' => $citation->publisher,
'year' => $citation->year,
'source_url' => $citation->citation_source_url,
'question' => $citation->question->name,
'topic'=> $citation->topic->name,
);
}
if(isset($citations))
{
$collection = collect($citations);
}
else
{
$citations = [];
$collection = collect($citations);
}
return $collection;
}
public function drawings()
{
$data = Citation::where('user_id', auth()->id())->get();
$drawings = [];
foreach($data as $key=>$citation)
{
$drawing = new Drawing();
$drawing->setPath(public_path('storage/'.$citation->citation_photo_path));
$drawing->setHeight(50);
$drawing->setWidth(120);
$drawing->setCoordinates('K'.($key+1));
$drawings [] = ($drawing);
}
return $drawings;
}
public function headings() :array
{
return ["Title","Source","Description","Author","Page Number","Publisher","Year","Citation Url","Question","Topic"];
}
Please or to participate in this conversation.