Skip to content

Instantly share code, notes, and snippets.

@j-tap
Last active August 7, 2021 23:50
Show Gist options
  • Save j-tap/4f3fb4b79c494fe96957fe64a8538e06 to your computer and use it in GitHub Desktop.
Save j-tap/4f3fb4b79c494fe96957fe64a8538e06 to your computer and use it in GitHub Desktop.
// Manual call to UserRequest validation
$userRequest = UserRequest::createFrom($request);
$validator = Validator::make($request->all(), $userRequest->rules());
$validatedData = $validator->validated(); // array
// Modify field in request
if ($request->filled('telegram'))
{
$request->merge([
'telegram' => ltrim($request->input('telegram'), '@'),
]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment