forked from alexjustesen/speedtest-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebhookFactory.php
More file actions
41 lines (37 loc) · 976 Bytes
/
Copy pathWebhookFactory.php
File metadata and controls
41 lines (37 loc) · 976 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
namespace Database\Factories;
use App\Enums\WebhookEvent;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Arr;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Webhook>
*/
class WebhookFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'url' => fake()->url(),
'events' => Arr::map(
fake()->randomElements(WebhookEvent::cases(), fake()->numberBetween(1, 3)),
fn (WebhookEvent $event): string => $event->value,
),
'enabled' => true,
'secret' => null,
];
}
/**
* Indicate that the webhook is disabled.
*/
public function disabled(): static
{
return $this->state(fn (array $attributes) => [
'enabled' => false,
]);
}
}