mirror of
https://github.com/brian8544/turtle-wow.git
synced 2024-12-31 20:04:35 +00:00
23 lines
557 B
PHP
23 lines
557 B
PHP
<?php
|
|
|
|
namespace App\Rules;
|
|
|
|
use App\Models\auth\GpHistory;
|
|
use Closure;
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
|
|
class UsedGamepointsCode implements ValidationRule
|
|
{
|
|
/**
|
|
* Run the validation rule.
|
|
*
|
|
* @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail
|
|
*/
|
|
public function validate(string $attribute, mixed $value, Closure $fail): void
|
|
{
|
|
if (GpHistory::where('code', $value)->first()) {
|
|
$fail(__('page_donate')['exception']['already_used']);
|
|
}
|
|
}
|
|
}
|