Cache not using getters, setters and casting
argonzalez2016 opened this issue · 2 comments
argonzalez2016 commented
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 commented
Hi @argonzalez2016,
This should be fixed in 2.3.1!
argonzalez2016 commented
Awesome!