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

Retrieve decrypted attribute through request #22

Closed
daandevos-old opened this issue Nov 28, 2018 · 1 comment
Closed

Retrieve decrypted attribute through request #22

daandevos-old opened this issue Nov 28, 2018 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@daandevos-old
Copy link

How am I able to retrieve the encrypted attribute decrypted through the HTTP request user object?

Like so: $request->user();

Currently I noticed that I just retrieve the not decrypted attribute.

@sander3 sander3 self-assigned this Nov 29, 2018
@sander3
Copy link
Owner

sander3 commented Dec 2, 2018

You could try something like this:

    /**
     * Convert the model instance to an array.
     *
     * @return array
     */
    public function toArray()
    {
        $attributes = $this->attributesToArray();
        $relations = $this->relationsToArray();

        foreach ($attributes as $key => $value) {
            $attributes[$key] = $this->getAttributeValue($key);
        }

        return array_merge($attributes, $relations);
    }

@sander3 sander3 added the question Further information is requested label Dec 2, 2018
@sander3 sander3 closed this as completed Dec 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants