File tree Expand file tree Collapse file tree 4 files changed +15
-2
lines changed Expand file tree Collapse file tree 4 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,6 @@ public function handle()
3939 return ;
4040 }
4141
42- $ this ->models ->first ()->searchableUsing ()->update ($ this ->models );
42+ $ this ->models ->first ()->makeSearchableUsing ( $ this -> models )-> first ()-> searchableUsing ()->update ($ this ->models );
4343 }
4444}
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ public function queueMakeSearchable($models)
6060 }
6161
6262 if (! config ('scout.queue ' )) {
63- return $ models ->first ()->searchableUsing ()->update ($ models );
63+ return $ models ->first ()->makeSearchableUsing ( $ models )-> first ()-> searchableUsing ()->update ($ models );
6464 }
6565
6666 dispatch ((new Scout::$ makeSearchableJob ($ models ))
@@ -151,6 +151,17 @@ public static function makeAllSearchable($chunk = null)
151151 ->searchable ($ chunk );
152152 }
153153
154+ /**
155+ * Modify the collection of models being made searchable.
156+ *
157+ * @param \Illuminate\Support\Collection $models
158+ * @return \Illuminate\Support\Collection
159+ */
160+ protected function makeSearchableUsing (BaseCollection $ models )
161+ {
162+ return $ models ;
163+ }
164+
154165 /**
155166 * Modify the query used to retrieve models when making all of the models searchable.
156167 *
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ public function test_searchable_using_update_is_called_on_collection()
2020 {
2121 $ collection = m::mock ();
2222 $ collection ->shouldReceive ('isEmpty ' )->andReturn (false );
23+ $ collection ->shouldReceive ('first->makeSearchableUsing ' )->with ($ collection )->andReturn ($ collection );
2324 $ collection ->shouldReceive ('first->searchableUsing->update ' )->with ($ collection );
2425
2526 $ model = new SearchableModel ();
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ public function test_handle_passes_the_collection_to_engine()
2020 $ model = m::mock (),
2121 ]));
2222
23+ $ model ->shouldReceive ('makeSearchableUsing ' )->with ($ collection )->andReturn ($ collection );
2324 $ model ->shouldReceive ('searchableUsing->update ' )->with ($ collection );
2425
2526 $ job ->handle ();
You can’t perform that action at this time.
0 commit comments