query()) ->transform(fn($xV) => is_null($xV) ? '' : $xV) ->merge($aNewQuery) ->all(); return $this->url() . '?' . http_build_query($aCleanQuery); }); Http::macro('nasa', function (string $sSiteWww, string $sVersion = 'v1') { $iTimestamp = time(); $sSecret = config('nasa.key'); $sToken = md5("timestamp={$iTimestamp}&secret={$sSecret}"); $bVerifySsl = config('nasa.verify_ssl'); if ($sSiteWww == 'dd.loc') { $h = "http"; } else { $h = "https"; } return Http::baseUrl($h."://" . $sSiteWww . "/api/nasa/{$sVersion}") ->acceptJson() ->timeout(10) ->throw() ->withHeaders([ 'X-Nasa-Timestamp' => $iTimestamp, 'X-Nasa-Token' => $sToken, ]) ->withOptions([ 'verify' => $bVerifySsl, // 'debug' => true ]); }); View::composer('components.layouts.nasa.app', function ($oView) { $oNavService = app(NasaNavService::class); $sCurrentPermissionSlug = request()->route() ? request()->route()->getName() : ''; $aNavInfo = $oNavService->aGetInfo($sCurrentPermissionSlug); $aWith = [ "aNavInfo" => $aNavInfo ]; $oView->with($aWith); }); } }