Skip to content

Commit b639670

Browse files
committed
Create ValidDuplicate.php
1 parent 5f059c9 commit b639670

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/Rules/ValidDuplicate.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace Milwad\LaravelValidate\Rules;
4+
5+
use Illuminate\Contracts\Validation\Rule;
6+
7+
class ValidDuplicate implements Rule
8+
{
9+
/**
10+
* Check base64.
11+
*
12+
* @param string $attribute
13+
* @param mixed $value
14+
* @return bool
15+
*/
16+
public function passes($attribute, $value)
17+
{
18+
$value = str_split($value);
19+
20+
return collect($value)->duplicates()->isEmpty();
21+
}
22+
23+
/**
24+
* Get the validation error message.
25+
*
26+
* @return string
27+
*/
28+
public function message()
29+
{
30+
return __('validate.duplicate');
31+
}
32+
}

0 commit comments

Comments
 (0)