return back with error and json reponse laravel code example
Example 1: php laravel return json response
return response()->json([
'name' => 'Abigail',
'state' => 'CA'
]);
Example 2: laravel response json status 500
return response()->json(['message' => 'error message'], 500);