new funcionality
This commit is contained in:
17
app/Rules/SafeWebhookUrl.php
Normal file
17
app/Rules/SafeWebhookUrl.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Rules;
|
||||
|
||||
use App\Support\WebhookEndpoints;
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
|
||||
class SafeWebhookUrl implements ValidationRule
|
||||
{
|
||||
public function validate(string $attribute, mixed $value, Closure $fail): void
|
||||
{
|
||||
if (! is_string($value) || ! WebhookEndpoints::isSafeUrl($value)) {
|
||||
$fail(__('messages.webhook_url_not_allowed'));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user