Daftar dan Belajar Sekarang!

Eror laravel not object

foto affandy04
6 Kontribusi 0 Coto
6 hari yang lalu
Trying to get property 'image' of non-object (View: C:\xampp\htdocs\data1\margareta\resources\views\home2.blade.php) controllenya public function update1(Request $request) { $dani = Gambar::find($request['id']); $dani->name = $request->get('name'); $image_path = "images/".$request->Image; if ($request->hasFile('image')) { $imageName = $request->image->getClientOriginalName(); $request->image->move(public_path('images'), $imageName); } $dani->image = $imageName; $dani->save(); return redirect('table_slider')->with('success', 'Selamat data user berhasil disimpan'); } (mohon bantu cara supaya bisa delete gambar sesuai table dan delete public - images) public function delete1(Request $request) { $dani = Gambar::find($request['id']); $dani->delete(); return redirect('table_slider')->with('success', 'Selamat data user berhasil disimpan'); } (mohon bantu supaya gambar bisa di panggil di public images dan namanya sesuai di table) public function home4(Request $request) { $dani = Gambar::find($request['id']); return view('home2', ['dani' => $dani]); } } (mohon bantu supaya gambar bisa di panggil di public images dan namanya sesuai di table) nama blade(home2) <div class="affandy-banner3"> <img src="{{ asset('images/'. $dani->image) }}" alt="Margareta"> </div> mohon bantuuuu

Jawaban
foto beckbella
61 Kontribusi 35 Coto
5 hari yang lalu
variable si $dani bisa jadi null/empty, coba di var_dump dulu aja di home4(). kalau ketemu error non-object berarti variable objetnya ke defined


Login untuk diksusi di forum sekolah koding