<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\User;
use App\Models\Meme;

class UserController extends Controller
{
    public function show($id)
    {
        $user = User::where('id', $id)->firstOrFail();
        $data = [
            'user' => $user,
            'memes' => Meme::where('user_id', $user->id)->orderByDesc('created_at')->paginate(20),
        ];
        return view('profile', ['data' => $data]);
    }
}
