так что мне действительно нужно сделать if isset внутри foreach, но каждый раз, когда я загружаю URL, окна выдают мне CLI перестал работать отчет, а затем моя подача ремесленника близка.
вот мой контроллер
public function nilairapor($id){
$mapel = DB::table('view_ket')
->where('id_isikelas', $id)
->where('id_tahun', $this->tahun)
->where('id_semester', $this->semester)->groupBy('namamapel')->get();
foreach ($mapel as $getid) {
if(isset(DB::table('view_sikap')->where('id_isikelas', $id)->where('id_mapel', $getid->id_mapel)->where('id_tahun', $this->tahun)->where('id_semester', $this->semester)->first())){
$nobserv = DB::table('view_sikap')
->where('id_isikelas', $id)
->where('id_mapel', $getid->id_mapel)
->where('namanilai', 'Nilai Observasi')
->where('id_tahun', $this->tahun)
->where('id_semester', $this->semester)->first()->nilai;
$nds = DB::table('view_sikap')
->where('id_isikelas', $id)
->where('id_mapel', $getid->id_mapel)
->where('namanilai', 'Nilai Diri Sendiri')
->where('id_tahun', $this->tahun)
->where('id_semester', $this->semester)->first()->nilai;
$nateman = DB::table('view_sikap')
->where('id_isikelas', $id)
->where('id_mapel', $getid->id_mapel)
->where('namanilai', 'Nilai Antar Teman')
->where('id_tahun', $this->tahun)
->where('id_semester', $this->semester)->first()->nilai;
$njurnal = DB::table('view_sikap')
->where('id_isikelas', $id)
->where('id_mapel', $getid->id_mapel)
->where('namanilai', 'Nilai Jurnal')
->where('id_tahun', $this->tahun)
->where('id_semester', $this->semester)->first()->nilai;
$nasikap = ($nobserv + $nds + $nateman + $njurnal) / 4;
}else{
$nasikap = 0;
}
echo $nasikap;
}
}
Я использую Windows 10 и PHP 5.6.3.
Удачного вам дня:)