php/app/Http/Controllers/HomeController.php
m1ngsama a158e64985 Implement comment, voting, and user profile features
Added controllers for comments, voting system, user profiles, and home page.
Includes nested comment support and karma calculation.
2025-12-09 16:20:00 +08:00

19 lines
397 B
PHP

<?php
namespace App\Http\Controllers;
use App\Models\Post;
use Illuminate\Http\Request;
class HomeController extends Controller
{
public function index()
{
$posts = Post::with(['user', 'community', 'comments'])
->orderBy('votes', 'desc')
->orderBy('created_at', 'desc')
->paginate(20);
return view('home', compact('posts'));
}
}