return json response in laravel with status code example
Example 1: laravel return response json
return response()->json([
'name' => 'Abigail',
'state' => 'CA',
]);
Example 2: laravel json response with error code
return Response::json([
'hello' => $value
], 201); // Status code here