95 lines
4.1 KiB
PHP
95 lines
4.1 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('title')
|
|
Profile of: {{ $user->username }}
|
|
@endsection
|
|
|
|
@section('content')
|
|
<div class="flex justify-center">
|
|
<div class="w-full md:w-8/12 lg:w-6/12 flex flex-col items-center md:flex-row">
|
|
|
|
<div class="w-8/12 lg:w-6/12 px-5">
|
|
<img src="{{ $user->pfp ? asset('uploads/pfps') . '/' . $user->pfp : asset('img/usuario.svg') }}"
|
|
alt="profile picture">
|
|
</div>
|
|
|
|
<div class="md:w-8/12 lg:w-6/12 px-5 md:flex md:flex-col md:justify-center py-10">
|
|
<div class="flex items-center gap-2">
|
|
<p class="text-gray-700 text-2xl">{{ $user->username }}</p>
|
|
|
|
@auth
|
|
@if ($user->id === auth()->user()->id)
|
|
<a href="{{ route('profile.index') }}" class="text-gray-500 hover:text-gray-600">
|
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
|
|
stroke="currentColor" class="size-6">
|
|
<path stroke-linecap="round" stroke-linejoin="round"
|
|
d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10" />
|
|
</svg>
|
|
</a>
|
|
@endif
|
|
@endauth
|
|
</div>
|
|
|
|
<p class="text-gray-800 text-sm mb-3 font-bold mt-5">
|
|
0
|
|
<span class="font-normal">Followers</span>
|
|
</p>
|
|
|
|
<p class="text-gray-800 text-sm mb-3 font-bold">
|
|
0
|
|
<span class="font-normal">Following</span>
|
|
</p>
|
|
|
|
<p class="text-gray-800 text-sm mb-3 font-bold">
|
|
{{ $user->posts->count() }}
|
|
<span class="font-normal">Posts</span>
|
|
</p>
|
|
|
|
@auth
|
|
@if ($user->id !== auth()->user()->id)
|
|
@if (!$user->following(auth()->user()))
|
|
<form action="{{ route('users.follow', $user) }}" method="POST">
|
|
@csrf
|
|
<input type="submit"
|
|
class="bg-blue-600 text-white uppercase rounded-lg px-3 py-1 text-xs font-bold cursor-pointer"
|
|
value="follow">
|
|
</form>
|
|
@else
|
|
<form action="{{ route('users.unfollow', $user) }}" method="POST">
|
|
@csrf
|
|
@method('DELETE')
|
|
<input type="submit"
|
|
class="bg-red-600 text-white uppercase rounded-lg px-3 py-1 text-xs font-bold cursor-pointer"
|
|
value="unfollow">
|
|
</form>
|
|
@endif
|
|
@endif
|
|
@endauth
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<section class="container mx-auto mt-10">
|
|
<h2 class="text-4xl text-center font-black my-10">Posts</h2>
|
|
|
|
@if ($posts->count())
|
|
<div class="grid md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
|
|
@foreach ($posts as $post)
|
|
<div>
|
|
<a href="{{ route('posts.show', ['post' => $post, 'user' => $user]) }}">
|
|
<img src="{{ asset('uploads') . '/' . $post->image }}" alt="{{ $post->title }}">
|
|
</a>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
|
|
<div class="my-10">
|
|
{{ $posts->links() }}
|
|
</div>
|
|
@else
|
|
<p class="text-gray-600 uppercase text-sm text-center font-bold">No posts yet</p>
|
|
@endif
|
|
</section>
|
|
@endsection
|