You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35Lines changed: 35 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -253,3 +253,38 @@ class MyCustomBuilder
253
253
In fact, you can also replace any eloquent method within your builder if you use `$this->shouldAvoidCache()` check and retrieve the cached data using `getFromQueryCache()` method, passing the method name as string, and, optionally, an array of columns that defaults to `['*']`.
254
254
255
255
Notice that the `getFromQueryCache()` method accepts a method name and a `$columns` parameter. If your method doesn't implement the `$columns`, don't pass it.
256
+
257
+
Note that some functions like `getQueryCacheCallback()` may come with an `$id` parameter.
258
+
The default behaviour of the package doesn't use it, since the query builder uses `->get()` by default that accepts only columns.
259
+
260
+
However, if your builder replaces functions like `find()`, `$id` is needed and you will also have to replace the `getQueryCacheCallback()` like so:
261
+
262
+
```php
263
+
class MyCustomBuilder
264
+
{
265
+
public function getQueryCacheCallback(string $method = 'get', $columns = ['*'], $id = null)
0 commit comments