Skip to content

Commit 66ab96c

Browse files
committed
Add withQuery api for query callback.
Revert with callback implementation since its BC.
1 parent 5c9a9d3 commit 66ab96c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/DataTableAbstract.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,14 +340,27 @@ public function with($key, $value = '')
340340
if (is_array($key)) {
341341
$this->appends = $key;
342342
} elseif (is_callable($value)) {
343-
$this->appends[$key] = $value;
343+
$this->appends[$key] = value($value);
344344
} else {
345345
$this->appends[$key] = value($value);
346346
}
347347

348348
return $this;
349349
}
350350

351+
/**
352+
* Add with query callback value on response.
353+
*
354+
* @param string $key
355+
* @param callable $value
356+
* @return $this
357+
*/
358+
public function withQuery($key, callable $value) {
359+
$this->appends[$key] = $value;
360+
361+
return $this;
362+
}
363+
351364
/**
352365
* Override default ordering method with a closure callback.
353366
*

0 commit comments

Comments
 (0)