BookStackApp_BookStack/database/factories/Api/ApiTokenFactory.php
Dan Brown a83150131a
Webhooks: Fixed failing delete-based events
Due to queue serialization.
Added a test to check a couple of delete events.
Added ApiTokenFactory to support.
Also made a couple of typing/doc updates while there.

Related to #4373
2023-07-12 16:16:12 +01:00

28 lines
688 B
PHP

<?php
namespace Database\Factories\Api;
use BookStack\Api\ApiToken;
use BookStack\Users\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
use Illuminate\Support\Str;
class ApiTokenFactory extends Factory
{
protected $model = ApiToken::class;
public function definition(): array
{
return [
'token_id' => Str::random(10),
'secret' => Str::random(12),
'name' => $this->faker->name(),
'expires_at' => Carbon::now()->addYear(),
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
'user_id' => User::factory(),
];
}
}