<?php
namespace App\Rules;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
class YoutubeLink implements ValidationRule
{
public function passes($attribute, $value)
{
return (bool) preg_match('/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=|\?v=)([^#\&\?]*).*/', $value);
}
public function message()
{
return 'The :attribute format is invalid YouTube URL.';
}
/**
* Indicates whether the rule should be implicit.
*
* @var bool
*/
public $implicit = true;
/**
* Run the validation rule.
*
* @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail
*/
public function validate(string $attribute, mixed $value, Closure $fail): void
{
//
}
}
Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]