rawilk / laravel-settings

Store Laravel application settings in the database.
https://randallwilk.dev/docs/laravel-settings
MIT License
185 stars 17 forks source link

all() method not working on Model #65

Closed ghost closed 3 weeks ago

ghost commented 4 months ago

Laravel Settings

latest

Laravel Version

11.x

Bug description

I am trying to get all settings for a user.

$user = Auth::user();
dd($user->settings()->all());

Returns an empty collection.

Illuminate\Support\Collection {#2596 ▼
  #items: []
  #escapeWhenCastingToString: false
}

but this works:

   dd($user->settings()->context('user')->all());

So it looks like the context is not applied automatically when calling settings()->all() on the User model.

Steps to reproduce

No response

Relevant log output

No response

rawilk commented 3 weeks ago

I believe this is related to #49. Using the DotNotationContextSerializer should resolve this issue for you.

I'm going to close this issue, but feel free to re-open if that serializer doesn't help with this.