How to get 200 response code from Laravel REST api

Last Updated: October 31, 2019

If you want to get 200 success message from your REST api built with Laravel, you can use the following code

response()->json(['error' => 'invalid'], 401);
response()->json(['success' => 'success'], 200);