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 Database\Factories;
9
10use App\Models\Beatmap;
11use App\Models\Build;
12use App\Models\ScoreToken;
13use App\Models\User;
14
15class ScoreTokenFactory extends Factory
16{
17 protected $model = ScoreToken::class;
18
19 public function definition(): array
20 {
21 return [
22 'beatmap_id' => Beatmap::factory()->ranked(),
23 'build_id' => Build::factory(),
24 'user_id' => User::factory(),
25
26 // depend on beatmap_id
27 'beatmap_hash' => fn (array $attr) => Beatmap::find($attr['beatmap_id'])->checksum,
28 'ruleset_id' => fn (array $attr) => Beatmap::find($attr['beatmap_id'])->playmode,
29 ];
30 }
31}