Club System
This commit is contained in:
25
app/Rules/XfUserExists.php
Normal file
25
app/Rules/XfUserExists.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Rules;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Translation\PotentiallyTranslatedString;
|
||||
|
||||
class XfUserExists implements ValidationRule
|
||||
{
|
||||
/**
|
||||
* Run the validation rule.
|
||||
*
|
||||
* @param Closure(string, ?string=): PotentiallyTranslatedString $fail
|
||||
*/
|
||||
public function validate(string $attribute, mixed $value, Closure $fail): void
|
||||
{
|
||||
$user = DB::connection('xenforo')->table('user')->where('user_id', $value)->first();
|
||||
if( !$user ){
|
||||
$fail("The user ID {$value} does not exist.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user