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

Cache not using getters, setters and casting #110

Closed
argonzalez2016 opened this issue Jan 29, 2022 Discussed in #77 · 2 comments
Closed

Cache not using getters, setters and casting #110

argonzalez2016 opened this issue Jan 29, 2022 Discussed in #77 · 2 comments

Comments

@argonzalez2016
Copy link

Discussed in #77

Originally posted by argonzalez2016 July 8, 2021
When I only use the database, settings are pulled properly.

If I cast to a Laravel collection, this works properly.

class CollectionCast implements SettingsCast 
{
    public function get($payload): Collection
    {
        return collect($payload);
    }

    public function set($payload): array
    {
        return $payload->toArray();
    }
}
public Collection $view_cache;    

public static function casts(): array
{
    return [
            'view_cache' => CollectionCast::class,
        ];
}

$setting->view_cache is a laravel collection and in the database is an array.

When I enable the cache, casting doesn't happen. The package only uses view_cache as an array and creates errors.

@rubenvanassche
Copy link
Member

Hi @argonzalez2016,

This should be fixed in 2.3.1!

@argonzalez2016
Copy link
Author

Awesome!

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

2 participants