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

Automatically remember the user who created or updated #850

Closed
tpow opened this issue Apr 7, 2023 · 1 comment
Closed

Automatically remember the user who created or updated #850

tpow opened this issue Apr 7, 2023 · 1 comment
Labels
enhancement A feature that exists, works as intended but needs to be improved feature request A feature that does not yet exist but will be a good addition to the library

Comments

@tpow
Copy link

tpow commented Apr 7, 2023

It would be handy to have a quick way to include created_by and updated_by properties in the model that automatically store the user id of the user making the change. This would be similar to the timestamps mixin (which provides the created_at and updated_at properties) and would be set and updated similarly - created_by stored when initially creating the object and updated_by stored when touched or changed.

When using the SoftDeletes mixin (which adds the deleted_at property), it might also be nice to include the deleted_by property.

I started looking at doing this. I am trying to figure out how to identify the "current user" generically to the ORM. Perhaps this mixin would be better placed in Masonite? I think this could be valuable to anyone using the ORM, though.

@tpow tpow added enhancement A feature that exists, works as intended but needs to be improved feature request A feature that does not yet exist but will be a good addition to the library labels Apr 7, 2023
@josephmancuso
Copy link
Member

This should be done as a mixin but i dont think it should be in the core project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A feature that exists, works as intended but needs to be improved feature request A feature that does not yet exist but will be a good addition to the library
Projects
None yet
Development

No branches or pull requests

2 participants