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
6namespace App\Models;
7
8use Carbon\Carbon;
9
10/**
11 * @property int $count
12 * @property int $user_id
13 * @property string $year_month
14 */
15class UserReplaysWatchedCount extends Model
16{
17 public $incrementing = false;
18 public $timestamps = false;
19
20 protected $primaryKey = ':composite';
21 protected $primaryKeys = ['user_id', 'year_month'];
22 protected $table = 'osu_user_replayswatched';
23
24 public function startDate()
25 {
26 $year = substr($this->year_month, 0, 2);
27 $month = substr($this->year_month, 2, 2);
28
29 return Carbon::parse("{$year}-{$month}-01");
30 }
31}