-
Notifications
You must be signed in to change notification settings - Fork 21
/
Install.php
66 lines (56 loc) · 2.22 KB
/
Install.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
namespace Backpack\FileManager\Console\Commands;
use Backpack\CRUD\app\Console\Commands\Traits\PrettyCommandOutput;
use Backpack\FileManager\FileManagerServiceProvider;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
class Install extends Command
{
use PrettyCommandOutput;
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'backpack:filemanager:install
{--timeout=300} : How many seconds to allow each process to run.
{--debug} : Show process output or not. Useful for debugging.';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Install elFinder interface for Backpack.';
/**
* Execute the console command.
*
* @return mixed Command-line output
*/
public function handle()
{
$this->infoBlock('Installing Backpack FileManager', 'Step 1');
// Creating uploads directory
$this->progressBlock('Creating uploads directory');
File::ensureDirectoryExists('public/uploads');
$this->closeProgressBlock();
// Publishing custom elfinder views
$this->progressBlock('Publishing custom elfinder views');
$this->executeArtisanProcess('vendor:publish', [
'--provider' => FileManagerServiceProvider::class,
]);
$this->closeProgressBlock();
// Adding sidebar menu item
$this->progressBlock('Adding menu item');
$this->executeArtisanProcess('backpack:add-menu-content', [
'code' => '<x-backpack::menu-item :title="trans(\'backpack::crud.file_manager\')" icon="la la-files-o" :link="backpack_url(\'elfinder\')" />',
]);
$this->closeProgressBlock();
// Done
$url = Str::of(config('app.url'))->finish('/')->append('admin/elfinder');
$this->infoBlock('Backpack FileManager installation complete.', 'done');
$this->note('Go to <fg=blue>$url</> to access your filemanager.');
$this->note('You may need to run <fg=blue>php artisan serve</> to serve your Laravel project.');
$this->newLine();
}
}