metabase
metabase copied to clipboard
feat: support laravel 10
Thank you for your contribution, here is a few suggestions:
- Remove unnecessary changes
- After this change, does the library still work for Laravel 8?
In lcobucci/jwt v5 Builder
is now immutable, calls to methods of $builder
such as $builder->withClaim()
no longer modify the instance, thus, a token with an empty body is generated...
$builder = $config
->builder();
if ($dashboard) {
$builder->withClaim('resource', ['dashboard' => $dashboard]);
} elseif ($question) {
$builder->withClaim('resource', ['question' => $question]);
$this->type = 'question';
} else {
throw new InvalidArgumentException('Dashboard or question must be specified');
}
$params = $this->params;
if (empty($params)) {
$params = (object) $params;
}
$builder->withClaim('params', $params);
dd($dashboard, $builder);
Following the upgrade guide and reassigning the $build
variable to the return value of every method called seems to work, I don't know if this should be considered as a "clean" solution though 😅
$builder = $config
->builder();
if ($dashboard) {
$builder = $builder->withClaim('resource', ['dashboard' => $dashboard]);
} elseif ($question) {
$builder = $builder->withClaim('resource', ['question' => $question]);
$this->type = 'question';
} else {
throw new InvalidArgumentException('Dashboard or question must be specified');
}
$params = $this->params;
if (empty($params)) {
$params = (object) $params;
}
$builder = $builder->withClaim('params', $params);
dd($dashboard, $builder);