mirror of
https://github.com/m1ngsama/php.git
synced 2025-12-24 07:56:01 +00:00
Added controllers for comments, voting system, user profiles, and home page. Includes nested comment support and karma calculation.
24 lines
566 B
PHP
24 lines
566 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Http\Request;
|
|
|
|
class UserController extends Controller
|
|
{
|
|
public function show(User $user)
|
|
{
|
|
$posts = $user->posts()
|
|
->with(['community', 'comments'])
|
|
->orderBy('created_at', 'desc')
|
|
->paginate(20);
|
|
|
|
$comments = $user->comments()
|
|
->with(['post', 'post.community'])
|
|
->orderBy('created_at', 'desc')
|
|
->paginate(20);
|
|
|
|
return view('users.show', compact('user', 'posts', 'comments'));
|
|
}
|
|
}
|