I'm trying to export a quiry result in Laravel 5 to excel it gives me the error Object of class stdClass could not be converted to string when i use the code below it works
$equipements=Equipement::all();
$equipements=collect($equipements)->toArray();
Excel::create('Inventaire',function($excel) use ($equipements){
$excel->sheet('Page 1',function ($sheet) use($equipements){
$sheet->fromArray($equipements);
});
})->export('xlsx');
but that's not the result i want, i want to specify fields from different tables, is there any way to convert a collection to array of strings the method collection->torray return array of objects that's not what i want.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire