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

Settings with same key, different user ID's. #34

Open
zacksmash opened this issue Nov 2, 2021 · 0 comments
Open

Settings with same key, different user ID's. #34

zacksmash opened this issue Nov 2, 2021 · 0 comments

Comments

@zacksmash
Copy link

zacksmash commented Nov 2, 2021

  • LaravelSettings Version: 8.12
  • Laravel Version: 8.1
  • PHP Version: 7.4

Description:

I'm use the same settings key for a global setting (user_id=0) and for a setting that's tied to a user. When attempting to fetch the global setting value, I get the user defined setting, instead. I would anticipate, if I'm not adding the setExtraColumns() to the method, it would default to the global (user_id=0) value.

Steps To Reproduce:

| user_id | key | value |
-------------------------
|   0     | foo | bar   |
|   1     | foo | baz   |

settings()->get('foo') // baz

settings()->setExtraColumns(['user_id' => auth()->id()])->get('foo'); // baz

settings()->setExtraColumns(['user_id' => 0])->get('foo'); // bar

Am I just understanding it wrong, or can the settings method default to uuser_id of 0 first?

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

No branches or pull requests

1 participant