コード例 #1
0
ファイル: User.php プロジェクト: roycocup/bjjcomp2
 public function getFightersFor($gender, $age_group, $belt, $weight)
 {
     $min_age = $this->age_categories[$age_group][0];
     $max_age = $this->age_categories[$age_group][1];
     $min_birthday = Helper::calculateBirthday($min_age);
     $max_birthday = Helper::calculateBirthday($max_age);
     $results = User::whereRaw('gender = ? AND belt = ? AND weight = ? AND dob BETWEEN ? AND ? ', array($gender, $belt, $weight, $max_birthday, $min_birthday))->orderBy('dob')->get();
     // $queries = DB::getQueryLog();
     // $last_query = end($queries);
     // var_dump($results->all(), $last_query, $age_group);
     return $results;
 }