Exemple #1
0
 public function getRanking($iso = false)
 {
     $this->user->pushCriteria(new OrderBy('points'));
     if (!$iso) {
         $users = $this->user->all()->take(32);
         $title = trans('user::ui.ranking.global');
     } else {
         $country = $this->country->findByField('iso2', $iso)->first();
         $users = $this->user->findWhere(['country_id' => $country->id]);
         $title = trans('user::ui.ranking.country', ['country' => $country->short_name]);
     }
     return theme('user.learning.ranking', compact('users', 'title'));
 }