1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-23 08:14:10 +00:00
pixelfed/app/Rules/ValidUrl.php

21 lines
518 B
PHP
Raw Normal View History

2024-07-23 07:30:03 +00:00
<?php
namespace App\Rules;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
class ValidUrl implements ValidationRule
{
/**
* Run the validation rule.
*
* @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail
*/
public function validate(string $attribute, mixed $value, Closure $fail): void
{
if (!str_starts_with(strtolower($value), 'https://')) {
$fail('The :attribute must start with https://.');
}
}
}