imanghafoori1/laravel-widgetize

how can i set key for extraCacheKeyDependency from params

payamomrani opened this issue · 3 comments

Hi
How can i set key for extraCacheKeyDependency() function from params ?
extraCacheKeyDependency just get from query string
i use widget for related products and pass product id to widget like this :

@widget('Product\RelatedWidget', ['product_id' => $product_id])

since the extraCacheKeyDependency is execute first ,I cannot consider the product_id to send to the function

It seems that you have to use the cache key method in this case.

It seems that you have to use the cache key method in this case.

thank you for replay

how can i get params in cacheKey?
cacheKey execute after data ?

Yes parameters are passed to it.
No it executed before data, because data should not execute if the result of it is already in the cache store.

https://github.com/imanghafoori1/laravel-widgetize/blob/master/README.md#public-function-cachekey