File manager - Edit - /var/www/html/spdc/api/app/Rules/UserExists.php
Back
<?php namespace App\Rules; use Illuminate\Contracts\Validation\InvokableRule; class UserExists implements InvokableRule { /** * Run the validation rule. * * @param string $attribute * @param mixed $value * @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail * @return void */ public function __invoke($attribute, $value, $fail) { // login $accessToken = authLogin()['access_token']; // request $url = env('AUTH_SERVICE_URL') . '/api/user/' . $value; $response = authServiceClient('get', $url, null, [ 'Authorization' => 'Bearer ' . $accessToken ]); if (!$response->successful()) $fail('O :attribute deve ser vĂ¡lido.'); } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.01 |
proxy
|
phpinfo
|
Settings