File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -31,11 +31,28 @@ class DeleteIndexCommand extends Command
3131 public function handle (EngineManager $ manager )
3232 {
3333 try {
34- $ manager ->engine ()->deleteIndex ($ this ->argument ('name ' ));
34+ $ manager ->engine ()->deleteIndex ($ name = $ this ->indexName ( $ this -> argument ('name ' ) ));
3535
36- $ this ->info ('Index " ' .$ this -> argument ( ' name ' ) .'" deleted. ' );
36+ $ this ->info ('Index " ' .$ name .'" deleted. ' );
3737 } catch (Exception $ exception ) {
3838 $ this ->error ($ exception ->getMessage ());
3939 }
4040 }
41+
42+ /**
43+ * Get the fully-qualified index name for the given index.
44+ *
45+ * @param string $name
46+ * @return string
47+ */
48+ protected function indexName ($ name )
49+ {
50+ if (class_exists ($ name )) {
51+ return (new $ name )->searchableAs ();
52+ }
53+
54+ $ prefix = config ('scout.prefix ' );
55+
56+ return ! Str::startsWith ($ name , $ prefix ) ? $ prefix .$ name : $ name ;
57+ }
4158}
You can’t perform that action at this time.
0 commit comments