Skip to content

Commit ae18b2e

Browse files
authored
Allow to specify wanted columns in search method
1 parent b377357 commit ae18b2e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Controls/RepositoryQuery.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,18 @@ public function list($orderByColumn, $orderBy = 'desc', $with = [], $columns = [
5959
* Search data
6060
*
6161
* @param string|int $searchTerm
62+
* @param array $columns
6263
*
6364
* @return mixed
6465
*/
65-
public function search($searchTerm)
66+
public function search($searchTerm, $columns = ['*'])
6667
{
6768
$this->applyCriteria();
6869
$this->applyScope();
6970

7071
$results = $this ->model
7172
->whereLike($this ->searchFields(), $searchTerm)
72-
->get();
73+
->get($columns);
7374

7475
$this->resetModel();
7576
$this->resetScope();
@@ -231,4 +232,4 @@ public function paginate($limit = null, $columns = ['*'], $method = "paginate")
231232

232233
return $results;
233234
}
234-
}
235+
}

0 commit comments

Comments
 (0)