Inheritance: extends Illuminate\Database\Eloquent\Model
 public function transform(Score $score)
 {
     return ['id' => $score->score_id, 'created_at' => $score->date->toIso8601String(), 'pp' => $score->pp, 'accuracy' => $score->accuracy(), 'rank' => $score->rank, 'mods' => $score->enabled_mods, 'score' => $score->score];
 }
Exemple #2
0
 private function _getScores($best, $limit)
 {
     $user_id = Request::input('u');
     $mode = intval(Request::input('m', 0));
     $type = Request::input('type', 'id');
     $scores = $best === true ? Score\Best\Model::getClass($mode) : Score\Model::getClass($mode);
     if ($scores === null) {
         return;
     }
     if (present($user_id)) {
         $user = User::lookup($user_id, $type);
         if (!$user) {
             return;
         }
         $scores = $scores->forUser($user);
     }
     if (present($limit)) {
         $scores = $scores->limit($limit);
     }
     $scores = $scores->whereHas('user', function ($q) {
         $q->where('user_warnings', '=', 0);
     });
     return $scores;
 }
Exemple #3
0
 private function _getScores($best, $limit)
 {
     $user_id = Request::input('u');
     $mode = Request::input('m', 0);
     $type = Request::input('type', 'id');
     if (!in_array($mode, [Beatmap::OSU, Beatmap::TAIKO, Beatmap::FRUITS, Beatmap::MANIA])) {
         return;
     }
     $klass = $best ? Score\Best\Model::getClass($mode) : Score\Model::getClass($mode);
     $scores = new $klass();
     if (present($user_id)) {
         $user = User::lookup($user_id, $type);
         if (!$user) {
             return;
         }
         $scores = $scores->forUser($user);
     }
     if (present($limit)) {
         $scores = $scores->limit($limit);
     }
     $scores = $scores->whereHas('user', function ($q) {
         $q->where('user_warnings', '=', 0);
     });
     return $scores;
 }