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

Data too long for column 'action' at row 1 #58

Closed
MCKLtech opened this issue Jan 3, 2022 · 2 comments · Fixed by #59
Closed

Data too long for column 'action' at row 1 #58

MCKLtech opened this issue Jan 3, 2022 · 2 comments · Fixed by #59

Comments

@MCKLtech
Copy link

MCKLtech commented Jan 3, 2022

We've occasionally been hitting this error, and from the looks of the stack trace, it seems like a huge amount of information is being stored in the action column. It would appear the entire User model is being stuffed in there.

We're using the library in a wrapper function, where the $route could be a named route or a URL:

if (Route::has($route)) {
 $redirect = redirect(route($route));
} else $redirect = redirect($route);

return MagicLink::create(new LoginAction($user, $redirect), $lifetime,$maxVisits)
@MCKLtech
Copy link
Author

MCKLtech commented Jan 4, 2022

Adding withoutRelations() seems to fix this issue. Perhaps, if relations are never needed, it would be advantageous for the package itself to implement this?

return MagicLink::create(
            new LoginAction(**$user->withoutRelations()**, $redirect),
            $lifetime,
            $maxVisits
        )

@cesargb cesargb linked a pull request Jan 4, 2022 that will close this issue
@cesargb
Copy link
Owner

cesargb commented Jan 4, 2022

Thanks for your feedback. In this issue we have 2 issues:

  1. too much user information stored
  2. wrapper method

Regarding the first problem, it would be interesting to store only the user's primary key.

I upload this PR #59

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 a pull request may close this issue.

2 participants