我试图将检索数据从对象转换为数组,但我有这个错误:
类stdClass的对象无法转换为字符串
here is screenshot of whole backtrace
这是代码:
$gallery = DB::table('galleryimages')
->join('gallery', 'gallery.id', '=', 'galleryimages.title_id')
->select('galleryimages.title_id')->take(10)
->get();
$array= (array) $gallery;
for( $i=0 ; $i<count($gallery); $i++){
$galleryimages = DB::table('galleryimages')->join('gallery', 'gallery.id','=','galleryimages.title_id')->where('gallery.id', '=', $array[$i])
->select('galleryimages.*','gallery.title','gallery.description')->get();
}