1<?php
2
3// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
4// See the LICENCE file in the repository root for full licence text.
5
6declare(strict_types=1);
7
8namespace App\Models;
9
10/**
11 * @property int $count
12 * @property string $name
13 */
14class Count extends Model
15{
16 public $incrementing = false;
17 public $timestamps = false;
18
19 protected $keyType = 'string';
20 protected $primaryKey = 'name';
21 protected $table = 'osu_counts';
22
23 public static function currentRankStartName(string $ruleset): string
24 {
25 return $GLOBALS['cfg']['osu']['scores']['experimental_rank_as_default']
26 ? "pp_rank_column_exp_{$ruleset}"
27 : "pp_rank_column_{$ruleset}";
28 }
29
30 public static function totalUsers(): static
31 {
32 return static::firstOrCreate(['name' => 'usercount'], ['count' => 0]);
33 }
34
35 public static function lastMailUserNotificationIdSent(): static
36 {
37 return static::firstOrCreate(['name' => 'last_mail_user_notification_id_sent'], ['count' => 0]);
38 }
39}