File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -158,7 +158,8 @@ public function paginate(
158158 $ perPage = null ,
159159 $ columns = ["* " ],
160160 $ pageName = "page " ,
161- $ page = null
161+ $ page = null ,
162+ $ total = null
162163 ) {
163164 if (! $ this ->isCachable ()) {
164165 return parent ::paginate ($ perPage , $ columns , $ pageName , $ page );
@@ -169,8 +170,18 @@ public function paginate(
169170 if (is_array ($ page )) {
170171 $ page = $ this ->recursiveImplodeWithKey ($ page );
171172 }
173+
172174 $ columns = collect ($ columns )->toArray ();
173- $ cacheKey = $ this ->makeCacheKey ($ columns , null , "-paginate_by_ {$ perPage }_ {$ pageName }_ {$ page }" );
175+ $ keyDifferentiator = "-paginate_by_ {$ perPage }_ {$ pageName }_ {$ page }" ;
176+
177+ if ($ total !== null ) {
178+ $ total = value ($ total );
179+ $ keyDifferentiator .= $ total !== null
180+ ? "_ {$ total }"
181+ : "" ;
182+ }
183+
184+ $ cacheKey = $ this ->makeCacheKey ($ columns , null , $ keyDifferentiator );
174185
175186 return $ this ->cachedValue (func_get_args (), $ cacheKey );
176187 }
You can’t perform that action at this time.
0 commit comments