2021-07-16 02:35:54 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use App\Models\User;
|
2021-07-26 22:39:11 -04:00
|
|
|
use App\Models\Meme;
|
2021-07-16 02:35:54 -04:00
|
|
|
|
|
|
|
class UserController extends Controller
|
|
|
|
{
|
|
|
|
public function show($id)
|
|
|
|
{
|
2021-07-26 22:39:11 -04:00
|
|
|
$user = User::where('id', $id)->firstOrFail();
|
2021-07-16 02:35:54 -04:00
|
|
|
$data = [
|
2021-07-26 22:39:11 -04:00
|
|
|
'user' => $user,
|
|
|
|
'memes' => Meme::where('user_id', $user->id)->orderByDesc('created_at')->paginate(20),
|
2021-07-16 02:35:54 -04:00
|
|
|
];
|
|
|
|
return view('profile', ['data' => $data]);
|
|
|
|
}
|
|
|
|
}
|