forked from metin2/web
Localized ranking and modified controllers to read data from cache tables.
This commit is contained in:
24
app/View/Composers/HighscoreComposer.php
Normal file
24
app/View/Composers/HighscoreComposer.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Composers;
|
||||
|
||||
use App\Models\Game\Highscore\GuildHighscoreCache;
|
||||
use App\Models\Game\Highscore\HighscoreCache;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class HighscoreComposer
|
||||
{
|
||||
/**
|
||||
* Bind data to the view.
|
||||
*/
|
||||
public function compose(View $view): void
|
||||
{
|
||||
// Fetch the top highscore
|
||||
$topHighscore = HighscoreCache::orderBy('id')->take(10)->get();
|
||||
$view->with('topHighscore', $topHighscore);
|
||||
|
||||
// Fetch the top guild highscore
|
||||
$topGuildHighscore = GuildHighscoreCache::orderBy('id')->take(10)->get();
|
||||
$view->with('topGuildHighscore', $topGuildHighscore);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user