3 namespace Database\Factories\Api;
5 use BookStack\Api\ApiToken;
6 use BookStack\Users\Models\User;
7 use Illuminate\Database\Eloquent\Factories\Factory;
8 use Illuminate\Support\Carbon;
9 use Illuminate\Support\Str;
11 class ApiTokenFactory extends Factory
13 protected $model = ApiToken::class;
15 public function definition(): array
18 'token_id' => Str::random(10),
19 'secret' => Str::random(12),
20 'name' => $this->faker->name(),
21 'expires_at' => Carbon::now()->addYear(),
22 'created_at' => Carbon::now(),
23 'updated_at' => Carbon::now(),
24 'user_id' => User::factory(),