mirror of
https://github.com/m1ngsama/php.git
synced 2025-12-24 16:01:19 +00:00
Added controllers for comments, voting system, user profiles, and home page. Includes nested comment support and karma calculation.
19 lines
397 B
PHP
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'));
|
|
}
|
|
}
|