4
4
5
5
use Illuminate \Console \Command ;
6
6
use Illuminate \Filesystem \Filesystem ;
7
+ use function Laravel \Prompts \confirm ;
7
8
8
9
class InstallCommand extends Command
9
10
{
@@ -17,50 +18,66 @@ public function handle(): void
17
18
$ this ->copyResourcesFiles ();
18
19
$ this ->copyResourcesSiteFiles ();
19
20
$ this ->copyResourcesComponentsFiles ();
21
+ $ this ->copyTranslationFile ();
20
22
21
23
$ this ->call ('storage:link ' );
22
24
25
+ $ this ->call ('modular:blog-migrate ' );
26
+
23
27
$ this ->info ('Modular Blog installed successfully. ' );
24
- $ this ->info ('Running the following command to migrate the Blog module: ' );
25
28
26
- if ($ this ->confirm ('Do you wish to run the Blog migrations? ' )) {
27
- $ this ->call ('modular:blog-migrate ' );
29
+ $ seederConfirmed = confirm (
30
+ label: 'Do you wish to run the Blog Seeders? ' ,
31
+ default: true ,
32
+ yes: 'Yes ' ,
33
+ no: 'No ' ,
34
+ hint: 'The seeder process may take a few seconds, it fetches some images '
35
+ );
28
36
29
- if ($ this ->confirm ('Do you wish to run the Blog seeders? ' )) {
30
- $ this ->call ('modular:blog-seed ' );
31
- }
37
+ if ($ seederConfirmed ) {
38
+ $ this ->call ('modular:blog-seed ' );
32
39
}
33
40
}
34
41
35
42
private function copyBlogModuleDirectory (): void
36
43
{
37
44
$ this ->info ('Copying Blog Module directory... ' );
38
45
(new Filesystem )->ensureDirectoryExists (base_path ('modules ' ));
39
- (new Filesystem )->copyDirectory (__DIR__ . '/../../stubs/modules/Blog ' , base_path ('modules/Blog ' ));
46
+ (new Filesystem )->copyDirectory (__DIR__ . '/../../stubs/modules/Blog ' , base_path ('modules/Blog ' ));
40
47
$ this ->info ('Blog Module directory copied successfully. ' );
41
48
}
42
49
43
50
private function copyResourcesComponentsFiles (): void
44
51
{
45
52
$ this ->info ('Copying Blog Module components... ' );
46
53
(new Filesystem )->ensureDirectoryExists (resource_path ('js/Components/Modules/Blog ' ));
47
- (new Filesystem )->copyDirectory (__DIR__ . '/../../stubs/resources/js/Components/Modules/Blog ' , resource_path ('js/Components/Modules/Blog ' ));
54
+ (new Filesystem )->copyDirectory (__DIR__ . '/../../stubs/resources/js/Components/Modules/Blog ' , resource_path ('js/Components/Modules/Blog ' ));
48
55
$ this ->info ('Blog Module components copied successfully. ' );
49
56
}
50
57
51
58
private function copyResourcesFiles (): void
52
59
{
53
60
$ this ->info ('Copying Blog Module resources... ' );
54
61
(new Filesystem )->ensureDirectoryExists (resource_path ('js/Pages ' ));
55
- (new Filesystem )->copyDirectory (__DIR__ . '/../../stubs/resources/js/Pages ' , resource_path ('js/Pages ' ));
62
+ (new Filesystem )->copyDirectory (__DIR__ . '/../../stubs/resources/js/Pages ' , resource_path ('js/Pages ' ));
56
63
$ this ->info ('Blog Module resources copied successfully. ' );
57
64
}
58
65
59
66
private function copyResourcesSiteFiles (): void
60
67
{
61
68
$ this ->info ('Copying Blog Module resources-site... ' );
62
69
(new Filesystem )->ensureDirectoryExists (base_path ('resources-site ' ));
63
- (new Filesystem )->copyDirectory (__DIR__ . '/../../stubs/resources-site ' , base_path ('resources-site ' ));
70
+ (new Filesystem )->copyDirectory (__DIR__ . '/../../stubs/resources-site ' , base_path ('resources-site ' ));
64
71
$ this ->info ('Blog Module resources-site copied successfully. ' );
65
72
}
73
+
74
+ private function copyTranslationFile (): void
75
+ {
76
+ $ paginationEnglish = base_path ('lang/en/pagination.php ' );
77
+
78
+ if (!file_exists ($ paginationEnglish )){
79
+ (new Filesystem )->ensureDirectoryExists (base_path ('lang/en ' ));
80
+ copy (__DIR__ .'/../../stubs/lang/en/pagination.php ' , base_path ('lang/en/pagination.php ' ));
81
+ }
82
+ }
66
83
}
0 commit comments