view
@foreach($post as $ps)
<div class="card">
<div class="card-header">
<img src="{{asset('img/python.png')}}" class="circle" width="20" height="20"> <b style="color:black;">{{ Auth::user()->name }}</b>
</div>
<div class="card-body">
<center><img src="{{ str_replace('public/', '', $ps->image) }}" alt="" style="width: 100%;" height="320"></center>
</div>
<div class="card-footer text-muted">
<b style="color:black;">{{ Auth::user()->email }}</b><br>
{{$ps->caption}}
</div>
</div>
<br><br>
@endforeach
controller
public function index()
{
$post=Post::all();
// dd($id);
return view('home', $post);
}
error
post (View: D:\xampp\htdocs\bima_1202174034\Modul5\resources\views\home.blade.php)
return view('home', ['posts' => $posts]);the array keys are what the variables will be named