|
|
|
@ -22,4 +22,25 @@ class User extends Authenticatable
|
|
|
|
|
'matrix_username',
|
|
|
|
|
'phone',
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
public static function validate_with_matrix_username(string $matrix_username)
|
|
|
|
|
{
|
|
|
|
|
$matrix_username = $matrix_username ?? '';
|
|
|
|
|
|
|
|
|
|
if($matrix_username == '')
|
|
|
|
|
return [
|
|
|
|
|
'error' => 'The username is empty, please, write username!!!'
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
$user = User::where('matrix_username', $matrix_username)->first();
|
|
|
|
|
|
|
|
|
|
if(!$user)
|
|
|
|
|
return [
|
|
|
|
|
'error' => 'A user with the username does not exist!!!'
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
'ok' => 'A user with the username is valid.'
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|