laravolt / metabase
将 Metabase 仪表板和问题嵌入您的应用程序
0.4.0
2022-04-24 23:14 UTC
Requires
- php: ^8.0
- illuminate/support: ^8.0|^9.0
- lcobucci/jwt: ^4.1
README
Blade 组件,用于将 Metabase 仪表板或问题嵌入您的网站。有关 Metabase 的更多信息,请访问 Metabase 官方网站。
安装
composer require laravolt/metabase
将以下条目添加到 config/services.php
'metabase' => [ 'url' => env('METABASE_URL'), 'secret' => env('METABASE_SECRET'), ],
最后,更新您的 .env
文件
METABASE_URL=https://metabase.example.com METABASE_SECRET=secret
Metabase 密钥可以在 Metabase 设置页面中找到(只有管理员可以访问)。
有关更多信息,请访问 https://metabase.net.cn/docs/latest/administration-guide/13-embedding.html
用法
<!-- embed dashboard --> <x-metabase dashboard="1"></x-metabase> <!-- embed question --> <x-metabase question="2"></x-metabase> <!-- passing html attributes --> <x-metabase question="2" width="80%" height="500px"></x-metabase> <!-- passing metabase parameters --> @php($params = ['category' => 'php']) <x-metabase dashboard="1" :params="$params"></x-metabase> // BEWARE of the colon in ":params" (not "param") because we are passing array variable directly to the component <!-- passing additional metabase parameters --> <x-metabase dashboard="1" :params="$params" :bordered="false" titled theme="night"></x-metabase>
常见问题
此对象未启用嵌入。
解决方案: https://metabase.net.cn/learn/embedding/embedding-charts-and-dashboards
未找到。
仪表板或问题 ID 无效。
信息似乎已损坏或被篡改。
密钥无效。