我已经尝试过(Laravel 5.2 - show first image from database)
但是我在photo_rumah上获得了“ rumahnya = n rumahnya = t rumahnya = I”的价值
controller
public function index()
{
//
$data = $this->dataRumah();
// dd($data);
return view('panelD.data_rumah',[
'data' => $data,
]);
}
// get data
public function dataRumah(){
$data = DB::table('datarumah')->get();
foreach($data as $keys => $value){
$photoRumah = DB::table('photorumah')->where('id_rumah', '=', $value->id_rumah)->get();
$value->DataPhoto = $photoRumah;
}
return $data;
}
blade
<a href="#"><img src="{{asset('././././assets/PhotoRumah/'.$itemPhoto->photo_rumah[0])}}" alt=""></a>
//when i echo i just got value "rumahnya= n rumahnya= t rumahnya= I" on photo_rumah