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

Make user class extensible #2479

Closed
Tofandel opened this issue Feb 21, 2024 · 2 comments · Fixed by #2498
Closed

Make user class extensible #2479

Tofandel opened this issue Feb 21, 2024 · 2 comments · Fixed by #2498

Comments

@Tofandel
Copy link
Contributor

Tofandel commented Feb 21, 2024

Summary

We need to provide an option to be able to override the Twill\User class, it would make it possible to provide a custom getAuthIdentifier for sessions to work correctly without requiring a morph (otherwise if we have multiple User models and guards, the default laravel session which only uses user_id has an overlap of id which causes user to be able to see the sessions of other users) or override other behaviors like using UUID instead of ID

It would also allow us to add fillable fields to users

Describe the solution you'd like

A new config option: twill.user_model defaulting to Twill\User

@ifox
Copy link
Member

ifox commented Feb 21, 2024

Hi @Tofandel, that's already possible using twill.models.user:

'user' => A17\Twill\Models\User::class,

@Tofandel
Copy link
Contributor Author

Tofandel commented Feb 21, 2024

I see thanks, there is still a few remnants of User::class though especially in the belongsTo of revisions and roles

I have noted 97+ usages of the User class in the code, so I'll send in a PR to fix this

Tofandel added a commit to Tofandel/twill that referenced this issue Feb 26, 2024
ifox pushed a commit that referenced this issue Feb 28, 2024
AidasK pushed a commit to AidasK/twill that referenced this issue May 4, 2024
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