edvinaskrucas / settings

Persistent settings package for Laravel 5.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

User-specific settings

Propaganistas opened this issue · comments

Hi

Thanks for your package. I'm glad we share the same philosophy regarding the already existing persistent settings packages.

How about a new feature to allow user-specific settings? Shouldn't be that hard to implement: a new fluent method forUser( ID or Model ) that prepends the requested $key with some string + id..

Of course this behavior can be self-coded in terms of a service class, but in my humble opinion it would also fit great in this package..

Hi.

Thanks for your suggestion, but you can implement some function wrapper with your own custom logic on how to generate setting keys, and then call original package functions.

Yeah I know. But as the last paragraph of my post states: "...in my humble opinion it would also fit great in this package.."

I think its quite a common use case when utilizing a package like this... Isn't it?
Anyway, it's totally up to you of course!

I just got an idea, hope I will find some time soon to implement it. Thanks for the suggestion :)

Context feature is implemented, you can check it.

Great generic implementation!

Hi

Time to reopen this.

It would be great if an override config could be contextual.
e.g. an oversimplified example:

'override' => [
    [
        // Override app.locale using settings.locale of user 1
        'context' => ['user' => 1],
        'override' => ['app.locale' => 'settings.locale'],
    ],
    [
        'context' => ['someOtherKey' => 'someValue'],
        'override' => ['app.name' => 'settings.name'],
    ]
],

Special care has to be taken when thinking about the implementation, since lots of Laravel's built-in services (such as auth() and as such hash) aren't bootstrapped yet when config is loaded.

Hi,

Nice proposal, will take a loot at this and will consider how to implement it.