I'm storing eloquent models with relationships in redis as a sorted set and as you know redis stores the data as json format.
Redis::zincrby('trending_products', 1, $product);
When retrieving the data from redis I use the hydrate function to convert the json formated data back to an eloquent collection, but the relationships are not preserved, they are appended to the attributes array
$trending_products = Redis::zrevrange('trending_products', 0, 4);
$trending_products= Product::hydrate(
array_map('json_decode', $trending_products)
);
How does one preserve the relations in an eloquent model when pulling data from redis.
Thanks Danny