Add guest push notifications and queue alerts
This commit is contained in:
41
database/factories/PushSubscriptionFactory.php
Normal file
41
database/factories/PushSubscriptionFactory.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Event;
|
||||
use App\Models\PushSubscription;
|
||||
use App\Models\Tenant;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class PushSubscriptionFactory extends Factory
|
||||
{
|
||||
protected $model = PushSubscription::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
$endpoint = $this->faker->url();
|
||||
|
||||
return [
|
||||
'tenant_id' => Tenant::factory(),
|
||||
'event_id' => Event::factory(),
|
||||
'guest_identifier' => Str::slug($this->faker->firstName()),
|
||||
'device_id' => (string) Str::uuid(),
|
||||
'endpoint' => $endpoint,
|
||||
'endpoint_hash' => hash('sha256', $endpoint),
|
||||
'public_key' => base64_encode(random_bytes(32)),
|
||||
'auth_token' => base64_encode(random_bytes(16)),
|
||||
'content_encoding' => 'aes128gcm',
|
||||
'status' => 'active',
|
||||
'language' => 'de',
|
||||
'user_agent' => 'Mozilla/5.0',
|
||||
];
|
||||
}
|
||||
|
||||
public function revoked(): static
|
||||
{
|
||||
return $this->state([
|
||||
'status' => 'revoked',
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user