I'm new to Laravel and use Laravel 9 for my REST API. The client sends data in JSON format when I want to authenticate the application. But I cannot authenticate JSON format with my below code. Can anyone help me to find out the problem?
public function loginUser(Request $request)
{
$validateUser = Validator::make($request->all(), [
'email' => 'required|email',
'password' => 'required'
]);
if ($validateUser->fails()) {
return response()->json([
'status' => false,
'message' => 'Validation errror',
'errors' => $validateUser->errors()
], 401);
}
}