mirror of
https://github.com/rico-vz/HeimerdingerLoL.git
synced 2025-12-06 18:20:48 +01:00
refactor: improve filtering of hidden posts in PostsController
- Refactored the code in `PostsController.php` to filter out hidden posts before sorting by date for better performance and accuracy. - Updated the blade template `listposts.blade.php` to adjust formatting and structure for displaying posts.
This commit is contained in:
@@ -10,7 +10,9 @@ class PostsController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$posts = Sheets::all()->sortByDesc('date');
|
||||
$posts = Sheets::all()->filter(function ($post) {
|
||||
return !$post->hidden;
|
||||
})->sortByDesc('date');
|
||||
$paginatedPosts = Paginate::collection($posts, 6);
|
||||
|
||||
return view('posts.index', [
|
||||
|
||||
Reference in New Issue
Block a user