showing posts on the user's profile
This commit is contained in:
parent
3deef3707e
commit
7295edd7d0
@ -16,8 +16,11 @@ class PostController extends Controller implements HasMiddleware
|
||||
|
||||
public function index(User $user, Request $request)
|
||||
{
|
||||
$posts = Post::where("user_id", $user->id)->get();
|
||||
|
||||
return view("dashboard", [
|
||||
"user" => $user
|
||||
"user" => $user,
|
||||
"posts" => $posts
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -33,4 +33,18 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="container mx-auto mt-10">
|
||||
<h2 class="text-4xl text-center font-black my-10">Posts</h2>
|
||||
|
||||
<div class="grid md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
|
||||
@foreach ($posts as $post)
|
||||
<div>
|
||||
<a href="#">
|
||||
<img src="{{ asset('uploads') . '/' . $post->image }}" alt="{{ $post->title }}">
|
||||
</a>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
|
Loading…
x
Reference in New Issue
Block a user