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\ApiKey;
11use App\Models\User;
12
13class ApiKeyFactory extends Factory
14{
15 protected $model = ApiKey::class;
16
17 public function definition(): array
18 {
19 return [
20 'api_key' => bin2hex(random_bytes(20)),
21 'app_name' => fn () => $this->faker->word(),
22 'app_url' => fn () => "https://{$this->faker->word()}",
23 'user_id' => User::factory(),
24 ];
25 }
26}