mirror of
https://repo.getmonero.org/AnonDev/xmrmemes.git
synced 2025-05-13 15:02:11 -04:00
Add sorting on home page and jumbotron
This commit is contained in:
parent
99941bfd53
commit
87ef210e1f
4 changed files with 59 additions and 3 deletions
|
@ -33,6 +33,33 @@ class MemeController extends Controller
|
|||
SEOTools::setTitle('Home');
|
||||
$data = [
|
||||
'memes' => Meme::with(['user', 'tips'])->orderByDesc('created_at')->paginate(20),
|
||||
'pt-0' => true,
|
||||
];
|
||||
return view('homepage', ['data' => $data]);
|
||||
}
|
||||
|
||||
public function mostTipped()
|
||||
{
|
||||
SEOTools::setTitle('Most Tipped Memes');
|
||||
$query = \DB::select("SELECT meme_id FROM `tips` GROUP BY meme_id ORDER BY SUM(AMOUNT) DESC");
|
||||
$ids = array_column($query, 'meme_id');
|
||||
$memes = Meme::with(['user', 'tips'])->whereIn('id', $ids)->orderByRaw("field(id,".implode(',',$ids).")")->paginate(20);
|
||||
$data = [
|
||||
'memes' => $memes,
|
||||
'pt-0' => true,
|
||||
];
|
||||
return view('homepage', ['data' => $data]);
|
||||
}
|
||||
|
||||
public function recentlyTipped()
|
||||
{
|
||||
SEOTools::setTitle('Recently Tipped Memes');
|
||||
$query = \DB::select("SELECT meme_id FROM `tips` ORDER BY created_at DESC");
|
||||
$ids = array_unique(array_column($query, 'meme_id'));
|
||||
$memes = Meme::with(['user', 'tips'])->whereIn('id', $ids)->orderByRaw("field(id,".implode(',',$ids).")")->paginate(20);
|
||||
$data = [
|
||||
'memes' => $memes,
|
||||
'pt-0' => true,
|
||||
];
|
||||
return view('homepage', ['data' => $data]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue