xmrmemes/app/Http/Controllers/UserController.php

21 lines
461 B
PHP
Raw Normal View History

2021-07-16 02:35:54 -04:00
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\User;
use App\Models\Meme;
2021-07-16 02:35:54 -04:00
class UserController extends Controller
{
public function show($id)
{
$user = User::where('id', $id)->firstOrFail();
2021-07-16 02:35:54 -04:00
$data = [
'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]);
}
}