File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,10 @@ protected function searchModels(Builder $builder)
117117 return false ;
118118 }
119119
120+ if (! $ builder ->query ) {
121+ return true ;
122+ }
123+
120124 foreach ($ columns as $ column ) {
121125 $ attribute = $ model ->{$ column };
122126
Original file line number Diff line number Diff line change @@ -38,6 +38,13 @@ protected function defineDatabaseMigrations()
3838 ]);
3939 }
4040
41+ public function test_it_can_retrieve_results_with_empty_search ()
42+ {
43+ $ models = SearchableUserModel::search ()->get ();
44+
45+ $ this ->assertCount (2 , $ models );
46+ }
47+
4148 public function test_it_can_retrieve_results ()
4249 {
4350 $ models = SearchableUserModel::search ('Taylor ' )->where ('email ' , 'taylor@laravel.com ' )->get ();
You can’t perform that action at this time.
0 commit comments