-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
User Model Context not used a second time #26
Comments
This issue is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
bad bot |
This issue is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
The reason why the context is lost on your model in that foreach loop is because the underlying settings service resets the context after each call. For this reason, I would just call it like this in your loop: foreach ($input as $key => $value) {
auth()->user()->settings()->set($key, $value);
} |
Laravel Settings
v2.2.2
Laravel Version
v10.15.0
Bug description
We have a array of settings to save per User
The first one
api_key
gets saved and the Context here isthe Model User Class Name & the User's id
The second one
api_secret
is also saved, but the Context isNULL
The result is
api_secret
gets shared by all Users!Steps to reproduce
Add
HasSettings
Trait to the User ModelLog-in so we can has a User Model as the Context
prepare some settings to save (from a request mostly)
Save the Settings
Relevant log output
No response
The text was updated successfully, but these errors were encountered: