@foreach($item_leave->pertanyaans->where('prodeskel_categorie_id', '17') as $pertanyaan) @php $data = $pertanyaan->lansia()->wherePivot('laporan_lansia_id', $laporanLansia->id)->first(); $jawaban = null; $default = null; $multiple = null; if(empty($data) || is_null($data)){ $empty = true; }else{ $empty = false; $data = $data->pivot; $multiple = \App\Models\LansiaHasAnswer::where('laporan_lansia_id', $laporanLansia->id) ->where('prodeskel_question_id', $pertanyaan->id)->get(); $default = \App\Models\LansiaHasDefault::where('laporan_lansia_id', $laporanLansia->id) ->where('prodeskel_question_id', $pertanyaan->id)->get(); } @endphp @endforeach