4
4
5
5
use Backpack \CRUD \app \Console \Commands \Traits \PrettyCommandOutput ;
6
6
use Illuminate \Console \Command ;
7
+ use Illuminate \Support \Str ;
7
8
8
9
class Install extends Command
9
10
{
10
11
use PrettyCommandOutput;
11
12
12
- protected $ progressBar ;
13
-
14
13
/**
15
14
* The name and signature of the console command.
16
15
*
@@ -34,48 +33,38 @@ class Install extends Command
34
33
*/
35
34
public function handle ()
36
35
{
37
- $ this ->progressBar = $ this ->output ->createProgressBar (4 );
38
- $ this ->progressBar ->minSecondsBetweenRedraws (0 );
39
- $ this ->progressBar ->maxSecondsBetweenRedraws (120 );
40
- $ this ->progressBar ->setRedrawFrequency (1 );
41
- $ this ->progressBar ->start ();
36
+ $ this ->infoBlock ('Installing Backpack FileManager ' , 'Step 1 ' );
42
37
43
- $ this ->line ( ' Creating uploads directory ' );
38
+ $ this ->progressBlock ( ' Creating uploads directory ' );
44
39
switch (DIRECTORY_SEPARATOR ) {
45
40
case '/ ' : // unix
46
- $ createUploadDirectoryCommand = ['mkdir ' , '-p ' , 'public/uploads ' ];
41
+ $ this -> executeProcess ( ['mkdir ' , '-p ' , 'public/uploads ' ]) ;
47
42
break ;
48
43
case '\\' : // windows
49
44
if (! file_exists ('public\uploads ' )) {
50
- $ createUploadDirectoryCommand = ['mkdir ' , 'public\uploads ' ];
45
+ $ this -> executeProcess ( ['mkdir ' , 'public\uploads ' ]) ;
51
46
}
52
47
break ;
53
48
}
54
- if (isset ($ createUploadDirectoryCommand )) {
55
- $ this ->executeProcess ($ createUploadDirectoryCommand );
56
- }
49
+ $ this ->closeProgressBlock ();
57
50
58
- $ this ->line (' Publishing elFinder assets ' );
51
+ // Publishing elFinder assets
52
+ $ this ->progressBlock ('Publishing elFinder assets ' );
59
53
$ this ->executeArtisanProcess ('elfinder:publish ' );
54
+ $ this ->closeProgressBlock ();
60
55
61
- $ this ->line (' Publishing custom elfinder views ' );
62
- $ this ->executeArtisanProcess ('vendor:publish ' , [
63
- '--provider ' => 'Backpack\FileManager\FileManagerServiceProvider ' ,
56
+ // Adding sidebar menu item
57
+ $ this ->progressBlock ('Adding sidebar menu item ' );
58
+ $ this ->executeArtisanProcess ('backpack:add-sidebar-content ' , [
59
+ 'code ' => '<li class="nav-item"><a class="nav-link" href="{{ backpack_url( \'elfinder \') }}"><i class="nav-icon la la-files-o"></i> <span>{{ trans( \'backpack::crud.file_manager \') }}</span></a></li> ' ,
64
60
]);
61
+ $ this ->closeProgressBlock ();
65
62
66
- $ this ->line (' Adding sidebar menu item ' );
67
- switch (DIRECTORY_SEPARATOR ) {
68
- case '/ ' : // unix
69
- $ this ->executeArtisanProcess ('backpack:add-sidebar-content ' , [
70
- 'code ' => '<li class="nav-item"><a class="nav-link" href="{{ backpack_url( \'elfinder \') }}"><i class="nav-icon la la-files-o"></i> <span>{{ trans( \'backpack::crud.file_manager \') }}</span></a></li> ' , ]);
71
- break ;
72
- case '\\' : // windows
73
- $ this ->executeArtisanProcess ('backpack:add-sidebar-content ' , [
74
- 'code ' => '<li class="nav-item"><a class="nav-link" href="{{ backpack_url( \'elfinder \') }}"><i class="nav-icon la la-files-o"></i> <span>{{ trans( \'backpack::crud.file_manager \') }}</span></a></li> ' , ]);
75
- break ;
76
- }
77
-
78
- $ this ->progressBar ->finish ();
79
- $ this ->info (' Backpack\FileManager installed. ' );
63
+ // Done
64
+ $ url = Str::of (config ('app.url ' ))->finish ('/ ' )->append ('admin/elfinder ' );
65
+ $ this ->infoBlock ('Backpack FileManager installation complete. ' , 'done ' );
66
+ $ this ->note ("Go to <fg=blue> $ url</> to access your filemanager. " );
67
+ $ this ->note ('You may need to run <fg=blue>php artisan serve</> to serve your Laravel project. ' );
68
+ $ this ->newLine ();
80
69
}
81
70
}
0 commit comments