mirror of
https://github.com/brian8544/turtle-wow.git
synced 2024-12-31 20:04:35 +00:00
25 lines
595 B
PHP
25 lines
595 B
PHP
<?php
|
|
|
|
namespace App\Rules;
|
|
|
|
use Closure;
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
class CurrentEmail implements ValidationRule
|
|
{
|
|
/**
|
|
* Run the validation rule.
|
|
*
|
|
* @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail
|
|
*/
|
|
public function validate(string $attribute, mixed $value, Closure $fail): void
|
|
{
|
|
$user = Auth::guard('account')->user();
|
|
|
|
if ($user->email != $value) {
|
|
$fail(__('change_email_modal')['exception']['current_email']);
|
|
}
|
|
}
|
|
}
|