Skip to content

Commit a0fb306

Browse files
committed
callback
1 parent 1af24b3 commit a0fb306

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# TNTSearch Driver for Laravel Scout - Laravel 5.3
1+
# TNTSearch Driver for Laravel Scout - Laravel 5.3/5.4
22

33
[![Latest Version on Packagist](https://img.shields.io/packagist/v/teamtnt/laravel-scout-tntsearch-driver.svg?style=flat-square)](https://packagist.org/packages/teamtnt/laravel-scout-tntsearch-driver)
44
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
55
[![Build Status](https://img.shields.io/travis/teamtnt/laravel-scout-tntsearch-driver/master.svg?style=flat-square)](https://travis-ci.org/teamtnt/laravel-scout-tntsearch-driver)
66
[![Quality Score](https://img.shields.io/scrutinizer/g/teamtnt/laravel-scout-tntsearch-driver.svg?style=flat-square)](https://scrutinizer-ci.com/g/teamtnt/laravel-scout-tntsearch-driver)
77
[![Total Downloads](https://img.shields.io/packagist/dt/teamtnt/laravel-scout-tntsearch-driver.svg?style=flat-square)](https://packagist.org/packages/teamtnt/laravel-scout-tntsearch-driver)
88

9-
This package makes it easy to add full text search support to your models with Laravel 5.3.
9+
This package makes it easy to add full text search support to your models with Laravel 5.3/5.4.
1010

1111
## Contents
1212

composer.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,15 @@
1010
}
1111
],
1212
"require": {
13+
"php": ">=5.6.4",
1314
"teamtnt/tntsearch": "1.0.*",
1415
"laravel/scout": "*",
15-
"illuminate/contracts": "~5.3",
16-
"illuminate/database": "~5.3",
17-
"illuminate/support": "~5.3"
16+
"illuminate/bus": "~5.4",
17+
"illuminate/contracts": "~5.4",
18+
"illuminate/database": "~5.4",
19+
"illuminate/pagination": "~5.4",
20+
"illuminate/queue": "~5.4",
21+
"illuminate/support": "~5.4"
1822
},
1923
"require-dev": {
2024
"mockery/mockery": "~0.9",
@@ -25,6 +29,11 @@
2529
"TeamTNT\\Scout\\": "src/"
2630
}
2731
},
32+
"autoload-dev": {
33+
"psr-4": {
34+
"Tests\\": "tests/"
35+
}
36+
},
2837
"extra": {
2938
"branch-alias": {
3039
"dev-master": "1.0-dev"

src/Engines/TNTSearchEngine.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function paginate(Builder $builder, $perPage, $page)
126126
*
127127
* @return mixed
128128
*/
129-
protected function performSearch(Builder $builder)
129+
protected function performSearch(Builder $builder, array $options = [])
130130
{
131131
$index = $builder->index ?: $builder->model->searchableAs();
132132
$limit = $builder->limit ?: 10000;
@@ -135,6 +135,15 @@ protected function performSearch(Builder $builder)
135135
$this->builder = $builder;
136136
$this->tnt->asYouType = $builder->model->asYouType ?: false;
137137

138+
if ($builder->callback) {
139+
return call_user_func(
140+
$builder->callback,
141+
$this->tnt,
142+
$builder->query,
143+
$options
144+
);
145+
}
146+
138147
return $this->tnt->search($builder->query, $limit);
139148
}
140149

0 commit comments

Comments
 (0)