I want to update the combobox, but when i run the program the error appears. the error said
Undefined variable: jenis (View: D:\laravel\makanan\resources\views\edit_upload.blade.php)
what is the solution and what sintax to use ?
this is sintax in the controller:
public function prosesedit($id, Request $request)
{
$makan = Gambar::find($id);
$nama_file = $makan->file;
$jenis = JenisMkn::select('id_jenis','jenis_makanan')->get();
if($request->hasfile('file'))
{
$file = $request->file('file');
$nama_file = time()."_".$file->getClientOriginalName();
$tujuan_upload = 'image_file';
$file->move($tujuan_upload,$nama_file);
}
$makan->update([
'file'=>$nama_file,
'nama_makanan'=>$request->makan,
'kode_makanan'=>$request->jenis,
]);
return redirect(route('makan'));
}
and this is html
<div class="form-group">
<b>Jenis Makanan</b>
<br/>
<select name="jenis" id="" class="form control input-sm">
@foreach ($jenis as $j)
<option value="{{$j->id_jenis}}">{{$j->jenis_makanan}}</option>
@endforeach
</select>
</div>
help me please