コード例 #1
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $data = [];
     $data['badges'] = Badge::all()->count();
     $data['questions'] = Question::published()->count();
     $data['answers'] = User::Member()->with('answeredQuestions')->count();
     $data['members'] = User::Member()->count();
     return view('admin.dashboard.index', compact('data'));
 }
コード例 #2
0
 public function index()
 {
     $users = User::Member()->lists('username', 'id');
     $badges = Badge::all()->lists('name', 'id');
     return view('admin.reward.index', compact('users', 'badges'));
 }
コード例 #3
0
ファイル: Game.php プロジェクト: pacoorozco/gamify-l5
 /**
  * Get a collection with members ordered by Experience Points.
  *
  * @param int $limitTopUsers
  *
  * @return mixed
  */
 public static function getRanking($limitTopUsers = 10)
 {
     $users = User::Member()->with('points')->get();
     $users = $users->sortByDesc(function ($user) {
         return $user->getExperiencePoints();
     })->take($limitTopUsers);
     return $users;
 }