File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed
Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ class Installable
99{
1010 public string $ name = '' ;
1111 public string $ handle = '' ;
12+ public string $ singularName = '' ;
1213 public string $ path = '' ;
1314 public array $ operations = [];
1415
@@ -22,6 +23,7 @@ public function __construct(array $config)
2223 {
2324 $ this ->name = $ config ['name ' ];
2425 $ this ->handle = $ config ['handle ' ];
26+ $ this ->singularName = $ config ['singular_name ' ] ?? '' ;
2527 $ this ->path = $ config ['path ' ];
2628 $ this ->operations = $ config ['operations ' ];
2729 }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Studio1902 \PeakCommands \Operations ;
4+
5+ use Illuminate \Support \Str ;
6+ use Studio1902 \PeakCommands \Models \Installable ;
7+ use function Laravel \Prompts \text ;
8+
9+ class Rename extends Operation
10+ {
11+
12+ public function __construct (array $ config )
13+ {
14+ }
15+
16+ public function run (): Installable
17+ {
18+ $ this ->installable ->rename = true ;
19+ $ this ->installable ->renameName = text (
20+ label: "What should be the collection name for ' {$ this ->installable ->name }'? " ,
21+ placeholder: "E.g. ' {$ this ->installable ->name }' " ,
22+ required: true
23+ );
24+
25+ $ this ->installable ->renameHandle = Str::slug ($ this ->installable ->renameName , '_ ' );
26+
27+ $ this ->installable ->renameSingularName = ucfirst (text (
28+ label: "What is the singular name for this ' {$ this ->installable ->renameName }' collection? " ,
29+ placeholder: "E.g. ' {$ this ->installable ->singularName }' " ,
30+ required: true
31+ ));
32+
33+ $ this ->installable ->renameSingularHandle = Str::slug ($ this ->installable ->renameSingularName , '_ ' );
34+
35+ return $ this ->installable ;
36+ }
37+ }
You can’t perform that action at this time.
0 commit comments