예제 #1
0
파일: Scoreable.php 프로젝트: ppy/osu-web
 public function getEnabledModsAttribute($value)
 {
     if ($this->_enabledMods === null) {
         $this->_enabledMods = ModsHelper::toArray($value);
     }
     return $this->_enabledMods;
 }
예제 #2
0
파일: Game.php 프로젝트: ppy/osu-web
 public function getModsAttribute($value)
 {
     if (empty($this->_mods)) {
         $this->_mods = ModsHelper::toArray($value);
     }
     return $this->_mods;
 }
예제 #3
0
파일: Model.php 프로젝트: ppy/osu-web
 public function scopeWithMods($query, $modsArray)
 {
     return $query->where(function ($q) use($modsArray) {
         if (in_array('NM', $modsArray, true)) {
             $q->orWhere('enabled_mods', 0);
         }
         $bitset = ModsHelper::toBitset($modsArray);
         if ($bitset > 0) {
             $q->orWhereRaw('enabled_mods & ? != 0', [$bitset]);
         }
     });
 }