the browser-facing portion of osu!
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\Achievement;
11
12class AchievementFactory extends Factory
13{
14 const GROUPINGS = ['Misc Achievements 1', 'Misc Achievements 2'];
15
16 const SLUGS = [
17 'all-packs-anime-1',
18 'all-packs-anime-2',
19 'all-packs-gamer-1',
20 'all-packs-gamer-2',
21 'all-packs-rhythm-1',
22 'all-packs-rhythm-2',
23 'osu-combo-500',
24 'osu-combo-750',
25 'osu-combo-1000',
26 'osu-combo-2000',
27 ];
28
29 protected $model = Achievement::class;
30
31 public function configure(): static
32 {
33 return $this->afterCreating(fn () => app('medals')->resetMemoized());
34 }
35
36 public function definition(): array
37 {
38 return [
39 'achievement_id' => fn () => $this->faker->unique()->numberBetween(1, 5000),
40 'description' => fn () => $this->faker->realText(30),
41 'grouping' => array_rand_val(static::GROUPINGS),
42 'image' => 'http://s.ppy.sh/images/achievements/gamer2.png',
43 'name' => fn () => substr($this->faker->catchPhrase(), 0, 40),
44 'ordering' => 0,
45 'progression' => 0,
46 'quest_instructions' => fn () => $this->faker->realText(30),
47 'slug' => array_rand_val(static::SLUGS),
48 ];
49 }
50}