@@ -62,20 +62,20 @@ public function getIndices(): Collection
6262 return Scout::$ plugin
6363 ->getSettings ()
6464 ->getIndices ()
65- ->filter (function (ScoutIndex $ scoutIndex ) {
65+ ->filter (function (ScoutIndex $ scoutIndex ) {
6666 if ($ scoutIndex ->replicaIndex ) {
6767 return false ;
6868 }
6969 if (is_array ($ scoutIndex ->criteria )) {
70- $ criteriaSiteIds = collect ($ scoutIndex ->criteria )->map (function ($ criteria ) {
70+ $ criteriaSiteIds = collect ($ scoutIndex ->criteria )->map (function ($ criteria ) {
7171 return Arr::wrap ($ criteria ->siteId );
7272 })->flatten ()->unique ()->values ()->toArray ();
7373 } else {
7474 $ criteriaSiteIds = Arr::wrap ($ scoutIndex ->criteria ->siteId );
7575 }
7676
7777
78- $ siteIds = array_map (function ($ siteId ) {
78+ $ siteIds = array_map (function ($ siteId ) {
7979 return (int )$ siteId ;
8080 }, $ criteriaSiteIds );
8181
@@ -91,7 +91,7 @@ public function getIndices(): Collection
9191
9292 public function searchableUsing (): Collection
9393 {
94- return $ this ->getIndices ()->map (function (ScoutIndex $ scoutIndex ) {
94+ return $ this ->getIndices ()->map (function (ScoutIndex $ scoutIndex ) {
9595 return Scout::$ plugin ->getSettings ()->getEngine ($ scoutIndex );
9696 });
9797 }
@@ -102,7 +102,7 @@ public function searchable(bool $propagate = true)
102102 return ;
103103 }
104104
105- $ this ->searchableUsing ()->each (function (Engine $ engine ) use ($ propagate ) {
105+ $ this ->searchableUsing ()->each (function (Engine $ engine ) use ($ propagate ) {
106106 if (!$ this ->validatesCriteria ($ engine ->scoutIndex )) {
107107 return $ engine ->delete ($ this ->owner );
108108 }
@@ -151,7 +151,7 @@ public function searchableRelations(): void
151151 return ;
152152 }
153153
154- $ this ->getRelatedElements ()->each (function (Element $ relatedElement ) {
154+ $ this ->getRelatedElements ()->each (function (Element $ relatedElement ) {
155155 /* @var SearchableBehavior $relatedElement */
156156 $ relatedElement ->searchable (false );
157157 });
@@ -167,7 +167,7 @@ public function getRelatedElements(): Collection
167167
168168 if (!empty ($ settings ->relatedElementTypes )) {
169169 return Collection::make ($ settings ->relatedElementTypes )
170- ->flatMap (function ($ className ) {
170+ ->flatMap (function ($ className ) {
171171 return $ className ::find ()->relatedTo ($ this ->owner )->site ('* ' )->all ();
172172 });
173173 }
@@ -210,9 +210,11 @@ public function shouldBeSearchable(): bool
210210 return false ;
211211 }
212212
213- // if ($this->owner->propagating) {
214- // return false;
215- // }
213+ if ($ this ->owner ->propagating ) {
214+ if (!Scout::$ plugin ->getSettings ()->allowPropagation ) {
215+ return false ;
216+ }
217+ }
216218
217219 if (ElementHelper::isDraftOrRevision ($ this ->owner )) {
218220 return false ;
0 commit comments