return response()->json([
'message' => 'No new orders!'
]);
Unfortunately, this response is not working? Ideally, I'd like to return a JSON response with 'Message' => 'No new orders!' with a status code 204 No Content.
I have these 2 included files in the controller...
use OhMyBrew\BasicShopifyAPI;
use GuzzleHttp\Client;
This utilizes this built-in helper from vendor/laravel/framework/src/Illuminate/foundation/helpers.php
if (! function_exists('response')) {
/**
* Return a new response from the application.
*
* @param \Illuminate\View\View|string|array|null $content
* @param int $status
* @param array $headers
* @return \Illuminate\Http\Response|\Illuminate\Contracts\Routing\ResponseFactory
*/
function response($content = '', $status = 200, array $headers = [])
{
$factory = app(ResponseFactory::class);
if (func_num_args() === 0) {
return $factory;
}
return $factory->make($content, $status, $headers);
}
}
return response()->json(['message' => 'No new orders!'], 204);
Are you hitting the right endpoint? Have you tried to see if the request shows up in the network tab of the browser's element inspector? – CotterAccept: "application/json"
? – Lilleynot working
? You need to be more specific to the problem. If you mean your JS code can't get the desired response, so just show us your JS code! – Parachronism