Diskusi Ferdy Dharmawan Dwi Budiono
Selesai
Ferdy Dharmawan Dwi Budiono
14 hari yang lalu
Ditanyakan pada: Menampilkan Single Data dengan Query Builder
Attempt to read property "title" on null
error shows when i put {{ $post->title }} on show.blade.php
anyway this is my show function in controller
$post=DB::table('posts')->select('id', 'title', 'content', 'created_at')->where('id', '=', $id)->first();
$view_data = [ 'post'=>$post];
return view('posts.show', $view_data);
and on my url shows like localhost:8000/posts/$post->id instead of localhost:8000/posts/1
this is the href on my index.blade.php {{url('posts/$post->id')}}
1 Jawaban
Muhammad Fakhry Burhanuddin
14 hari yang lalu
Jawaban Terpilih
Itu artinya ada object yang bernilai null.
Silahkan dilampirkan github source code projectnya ya kak untuk bisa kami bantu periksa ya kak.