Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support laravel 10 #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kingdeveloper6200
Copy link

No description provided.

@uyab
Copy link
Contributor

uyab commented Sep 25, 2023

Thank you for your contribution, here is a few suggestions:

  1. Remove unnecessary changes
  2. After this change, does the library still work for Laravel 8?

@deerf0x
Copy link

deerf0x commented Feb 25, 2024

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...

image

image

        $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);

image

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);

image

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants