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\Group;
11
12class GroupFactory extends Factory
13{
14 protected $model = Group::class;
15
16 public function configure(): static
17 {
18 return $this->afterCreating(function () {
19 app('groups')->resetMemoized();
20 });
21 }
22
23 public function definition(): array
24 {
25 return [
26 'group_name' => fn() => "{$this->faker->colorName()} {$this->faker->domainWord()}",
27 'group_desc' => fn() => $this->faker->sentence(),
28 'identifier' => fn () => $this->faker->domainWord(),
29
30 // depends on identifier
31 'short_name' => fn (array $attr) => strtoupper($attr['identifier']),
32 ];
33 }
34}