I want to change the data absent but an error appears 'Trying to get the property' id 'of non-object' I do not understand why even though I have done it before and it's fine. and my relationship table is in apache MySql so my model is blank. I've tried to match my other edit method but nothing is wrong
this my edit()
public function edit($id)
{
$absensi = absensi::find($id);
$dataSiswa = DB::table('absensis')
->join('siswas', 'siswas.id', '=', 'absensis.idSiswa')
->select('absensis.*', 'siswas.nama')
->where([
['siswas.id', $absensi->idSiswa],
])->first();
return view('absensi.edit', ['absensi'=> $dataSiswa]);
}
and then this is my blade
<div class="card-header">
<h1>Edit Data Absensi </h1>
</div>
<div class="card-body">
<form action="/absensi/" method="POST" name="form1" >
<div class="form-group">
<label for="usr">Nama :</label>
<input type="text" value="">
</div>
<div class="form-group">
<label for="usr">Semester :</label>
<select name="semester" class="form-control" id="sel1">
<option value="genap"@if ($dataSiswa->semester=="ganjil") selected @endif>ganjil</option>
<option value="ganjil"@if ($dataSiswa->semester=="genap") selected @endif>genap</option>
</select>
</div>
<div class="form-group">
<input type="hidden" class="form-control" name="kelas" value="">
</div>
<div class="form-group">
<label for="comment">izin:</label>
<input type="number" class="form-control" name="izin" value="">
</div>
<div class="form-group">
<label for="comment">Sakit :</label>
<input type="number" class="form-control" name="sakit" value="">
</div>
<div class="form-group">
<label for="comment">Tanpa Keterangan :</label>
<input type="number" class="form-control" name="tanpaKeterangan" value="">
</div>
<button type="submit" class="btn btn-primary" id="Submit" name="Submit">simpan perubahan</button>
</form>
</div>
</div>
</div>
from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2KtRwAZ
via IFTTT
Aucun commentaire:
Enregistrer un commentaire