Skip to content

Instantly share code, notes, and snippets.

@cybertiwari
Created May 23, 2025 09:31
Show Gist options
  • Save cybertiwari/e3923a653a8846cad92a3e107547b0e7 to your computer and use it in GitHub Desktop.
Save cybertiwari/e3923a653a8846cad92a3e107547b0e7 to your computer and use it in GitHub Desktop.
use Illuminate\Support\Facades\Validator;
$validateUser = Validator::make($request->all(),
[
'name' => 'required',
'email' => 'required|email|unique:users,email',
'password' => 'required'
]);
if($validateUser->fails()){
return response()->json([
'status' => false,
'message' => 'validation error',
'errors' => $validateUser->errors()
], 401);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment