From 2ec6ef61696f170afa5fb3dc8c5bb339c997f1dd Mon Sep 17 00:00:00 2001 From: Bayu Hendra Winata Date: Mon, 25 Apr 2022 06:14:26 +0700 Subject: [PATCH] fix empty params reference: https://github.com/metabase/embedding-reference-apps/tree/master/laravel/embedded_analytics --- src/MetabaseService.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/MetabaseService.php b/src/MetabaseService.php index b8d9ff0..797443f 100644 --- a/src/MetabaseService.php +++ b/src/MetabaseService.php @@ -26,10 +26,6 @@ class MetabaseService */ public function setParams(array $params): void { - if (empty($params)) { - $params = ['foo' => null]; - } - $this->params = $params; } @@ -70,14 +66,18 @@ public function generateEmbedUrl(?int $dashboard, ?int $question): string throw new InvalidArgumentException('Dashboard or question must be specified'); } - $builder->withClaim('params', $this->params); + $params = $this->params; + if (empty($params)) { + $params = (object) $params; + } + $builder->withClaim('params', $params); $token = $builder ->getToken($config->signer(), $config->signingKey()) ->toString(); return sprintf( - '%s/embed/%s/%s#' . http_build_query($this->additionalParams), + '%s/embed/%s/%s#'.http_build_query($this->additionalParams), config('services.metabase.url'), $this->type, $token