File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33namespace App \Commands \Concerns ;
44
5- use function Laravel \Prompts \select ;
5+ use function Laravel \Prompts \search ;
66use function Laravel \Prompts \spin ;
77
88trait InteractWithServer
@@ -16,12 +16,13 @@ protected function selectServer(): string
1616 exit (1 );
1717 }
1818
19- return select (
20- 'Select a server: ' ,
21- collect ($ servers )
19+ return search (
20+ label: 'Select a server: ' ,
21+ options: fn ( $ search ) => collect ($ servers )
2222 ->mapWithKeys (fn ($ server ) => [
2323 $ server ['name ' ] => $ server ['name ' ].' ( ' .$ server ['ip_address ' ].') ' ,
2424 ])
25+ ->filter (fn ($ name ) => str_contains ($ name , $ search ))
2526 ->toArray (),
2627 scroll: 10
2728 );
Original file line number Diff line number Diff line change 33namespace App \Commands \Concerns ;
44
55use App \Traits \DomainSuggestions ;
6- use function Laravel \Prompts \select ;
6+
7+ use function Laravel \Prompts \search ;
78
89trait InteractWithSite
910{
@@ -37,9 +38,15 @@ protected function getServerAndSite(): array
3738 protected function selectSite ($ serverId ): array
3839 {
3940 $ sites = collect ($ this ->ploi ->getSiteList ($ serverId )['data ' ])
40- ->pluck ('domain ' , 'domain ' )
41- ->toArray ();
42- $ domain = select ('Select a site by domain: ' , $ sites , scroll: 10 );
41+ ->pluck ('domain ' , 'domain ' );
42+
43+ $ domain = search (
44+ label: 'Select a site by domain: ' ,
45+ options: fn (string $ search ) => $ sites
46+ ->filter (fn ($ name ) => str_contains ($ name , $ search ))
47+ ->toArray (),
48+ scroll: 10
49+ );
4350
4451 return ['domain ' => $ domain ];
4552 }
You can’t perform that action at this time.
0 commit comments