benim laravel 4 projesinde Excel'e ihracat uygulamayaNesne dizeye dönüştürülemedi - laravel
this documentation takip ediyorum.
Yani böyle diziden excel dosyası oluşturmak için çalışıyorum:
//$results is taken with db query
$data = array();
foreach ($results as $result) {
$result->filed1 = 'some modification';
$result->filed2 = 'some modification2';
$data[] = $result;
}
Excel::create('Filename', function($excel) use($data) {
$excel->sheet('Sheetname', function($sheet) use($data) {
$sheet->fromArray($data);
});
})->export('xls');
Ama bu durum oluşturur: Yanlış yapıyorum
Object of class stdClass could not be converted to string
?
UPDATE: Bu çalıştı
:
$data = get_object_vars($data);
sonuçlanır:
get_object_vars() expects parameter 1 to be object, array given
Bu: ilk hata
$data = (array)$data;
sonuçları.
Yapılandırmanızla ilgili bir şeyi kaçırdığınızı düşünüyorum. Servis Sağlayıcı ve diğer adlar için 'app/config.php' dosyanızı kontrol edin. –