src/Helper.php
public static function addAcceptableJsonTypeForRequest(Closure $determination = null, Closure $callback = null)
    {
        app()->rebinding('request', function ($app, Request $request) use ($determination, $callback) {
            if (is_null($determination) || $determination($request)) {
                $accept = $request->headers->get('Accept');

                if (! Str::contains($accept, ['/json', '+json'])) {
                    $accept = rtrim('application/json,'.$accept, ',');

                    $request->headers->set('Accept', $accept);
                    $request->server->set('HTTP_ACCEPT', $accept);
                    $_SERVER['HTTP_ACCEPT'] = $accept;

                    if ($callback) {
                        $callback($request);
                    }
                }
            }
        });
    }
public static function addAcceptableJsonTypeForRequest(Closure $determination = null, Closure $callback = null)
    {
        app()->rebinding('request', function ($app, Request $request) use ($determination, $callback) {
            if (is_null($determination) || $determination($request)) {
                $accept = $request->headers->get('Accept');

                if (! Str::contains($accept, ['/json', '+json'])) {
                    $accept = rtrim('application/json,'.$accept, ',');

                    $request->headers->set('Accept', $accept);
                    $request->server->set('HTTP_ACCEPT', $accept);
                    $_SERVER['HTTP_ACCEPT'] = $accept;

                    if ($callback) {
                        $callback($request);
                    }
                }
            }
        });
    }
Add JSON type to the "Accept" header for the request.

@see https://laravel-china.org/topics/3430

@param  \Closure  $determination
@param  \Closure  $callback
@return mixed