Implement webhook inspector
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\WebhookEndpoint;
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
|
||||
Broadcast::channel('App.Models.User.{id}', function (User $user, string $id): bool {
|
||||
return (string) $user->getKey() === $id;
|
||||
});
|
||||
|
||||
Broadcast::channel('webhooks.{endpointId}', function (User $user, string $endpointId): bool {
|
||||
$endpoint = WebhookEndpoint::query()->find($endpointId);
|
||||
|
||||
return $endpoint instanceof WebhookEndpoint
|
||||
&& ! $endpoint->is_public
|
||||
&& (string) $endpoint->user_id === (string) $user->getKey();
|
||||
});
|
||||
Reference in New Issue
Block a user