public static function setCurrentAppKeyForRequest($key, Request $request = null)
    {
        $request = $request ?: app('request');

        $request->attributes->set(static::CURRENT_APP_KEY, $key);

        return $request;
    }