<commit_before><?php

class Winner extends Eloquent {

  /**
   * The attributes which may be mass-assigned.
   *
   * @var array
   */
  protected $fillable = [
    'rank', 'description'
  ];

  // No timestamps on the winners table.
  public $timestamps = false;

  /**
   * A winner belongs to a candidate.
   */
  public function candidate()
  {
    return $this->belongsTo('Candidate');
  }

  /**
   * Get the winners, given a category.
   */
  public static function getCategoryWinners(category $category)
  {
    $settings = App::make('SettingsRepository')->all();
    if ($settings['show_winners']) {
      $winners = DB::table('winners')
                    ->join('candidates', 'winners.candidate_id', '=', 'candidates.id')
                    ->join('categories', 'candidates.category_id', '=', 'categories.id')
                    ->where('categories.id', '=', $category->id)
                    ->select('winners.rank', 'winners.description', 'candidates.name', 'candidates.slug', 'candidates.photo', 'candidates.id')
                    ->orderBy('winners.rank')
                    ->get();

      return $winners;
    }
    return;

  }
}
<commit_msg>Added in an override to preview winners.<commit_after><?php

class Winner extends Eloquent {

  /**
   * The attributes which may be mass-assigned.
   *
   * @var array
   */
  protected $fillable = [
    'rank', 'description'
  ];

  // No timestamps on the winners table.
  public $timestamps = false;

  /**
   * A winner belongs to a candidate.
   */
  public function candidate()
  {
    return $this->belongsTo('Candidate');
  }

  /**
   * Get the winners, given a category.
   */
  public static function getCategoryWinners(category $category)
  {
    $settings = App::make('SettingsRepository')->all();
    $secrets = Request::get('winners');
    if ($settings['show_winners'] || $secrets == '✓') {
      $winners = DB::table('winners')
                    ->join('candidates', 'winners.candidate_id', '=', 'candidates.id')
                    ->join('categories', 'candidates.category_id', '=', 'categories.id')
                    ->where('categories.id', '=', $category->id)
                    ->select('winners.rank', 'winners.description', 'candidates.name', 'candidates.slug', 'candidates.photo', 'candidates.id')
                    ->orderBy('winners.rank')
                    ->get();

      return $winners;
    }
    return;

  }
}

{'fraction_non_alphanumeric': 0.1635012386457473, 'fraction_numerical': 0.0, 'mean_word_length': 2.379358437935844, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3787615', 'n_tokens_mistral': 758, 'n_tokens_neox': 720, 'n_words': 156}