@@ 9-22 (lines=14) @@ | ||
6 | use Albert221\Validation\Rule\RuleTrait as RuleTrait; |
|
7 | use App\Models\User; |
|
8 | ||
9 | class EmailAvailable implements RuleInterface |
|
10 | { |
|
11 | use RuleTrait; |
|
12 | ||
13 | public function __construct() |
|
14 | { |
|
15 | $this->message = 'Ten adres email jest już zajęty'; |
|
16 | } |
|
17 | ||
18 | public function test($value) |
|
19 | { |
|
20 | return User::where('email', $value)->count() === 0; |
|
21 | } |
|
22 | } |
|
23 |
@@ 9-22 (lines=14) @@ | ||
6 | use Albert221\Validation\Rule\RuleTrait as RuleTrait; |
|
7 | use App\Models\User; |
|
8 | ||
9 | class EmailOccupied implements RuleInterface |
|
10 | { |
|
11 | use RuleTrait; |
|
12 | ||
13 | public function __construct() |
|
14 | { |
|
15 | $this->message = 'Nie istnieje konto o podanym adresie email'; |
|
16 | } |
|
17 | ||
18 | public function test($value) |
|
19 | { |
|
20 | return User::where('email', $value)->count() !== 0; |
|
21 | } |
|
22 | } |
|
23 |