mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-11-29 11:43:26 +01:00
30 lines
620 B
PHP
30 lines
620 B
PHP
<?php
|
|
|
|
namespace App\Rules;
|
|
|
|
use Closure;
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Support\Facades\Validator;
|
|
|
|
class IsValideEmailList implements ValidationRule
|
|
{
|
|
/**
|
|
* Run the validation rule.
|
|
*/
|
|
public function validate(string $attribute, mixed $value, Closure $fail): void
|
|
{
|
|
$emails = explode('|', $value);
|
|
|
|
$pass = Validator::make(
|
|
$emails,
|
|
[
|
|
'*' => 'email',
|
|
]
|
|
)->passes();
|
|
|
|
if (! $pass) {
|
|
$fail('validation.custom.email.IsValidEmailList')->translate();
|
|
}
|
|
}
|
|
}
|