Skip to content

ehsan9ir/laravel-metabase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Metabase Laravel

First Metabase should be installed . You can get more info Here.

Installation

Step 1 - Install the package

You can install ehsan9/metabase-laravel with Composer directly in your project:

$ composer require ehsan9/metabase-laravel

Step 2 - Publish

Run this command in your project directory:

php artisan vendor:publish --provider="Ehsan9\MetabaseLaravel\MetabaseServiceProvider"

Step 3 - Set config

Now you must define your Metabase Url, Username and Password to project. for this head to config/metabase-api.php then put your metabase info in the code:

return [
    'url' => 'https://yoursmetabase.com',
    'username' => 'your_metabase_username',
    'password' => 'your_metabase_pass'
];

Usage

You can use the package where ever you want.

  • Method 1:

    • First use the class:
      use Ehsan9\MetabaseLaravel\MetabaseApi;
    • Then use this pattern to connect Metabase api:
      $metabaseApi = new \Ehsan9\MetabaseLaravel\MetabaseApi(
          config('metabase-api.url'), config('metabase-api.username'), config('metabase-api.password')
      );
              $parameters = [
                  [
                      "type" => "category",
                      "value" => "YOUR_VALUE",
                      "target" => [
                          "variable",
                          [
                              "template-tag",
                              "member_id"
                          ]
                      ]
                  ]
              ];
      
      $result = $metabaseApi->getQuestion('questionId', 'json', $parameters);
  • Method 2:

    • use MetabaseApi Facade in ServiceProvider
    use Ehsan9\MetabaseLaravel\Facades\MetabaseApi;
    • then use this pattern
      MetabaseApi::getQuestion('questionId');

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages