1
|
|
|
<?php namespace Arcanesoft\Foundation\Console; |
2
|
|
|
|
3
|
|
|
use Arcanesoft\Foundation\Seeds\DatabaseSeeder; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Class InstallCommand |
7
|
|
|
* |
8
|
|
|
* @package Arcanesoft\Foundation\Console |
9
|
|
|
* @author ARCANEDEV <[email protected]> |
10
|
|
|
*/ |
11
|
|
|
class InstallCommand extends Command |
12
|
|
|
{ |
13
|
|
|
/* ----------------------------------------------------------------- |
14
|
|
|
| Properties |
15
|
|
|
| ----------------------------------------------------------------- |
16
|
|
|
*/ |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* The name and signature of the console command. |
20
|
|
|
* |
21
|
|
|
* @var string |
22
|
|
|
*/ |
23
|
|
|
protected $signature = 'foundation:install'; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* The console command description. |
27
|
|
|
* |
28
|
|
|
* @var string |
29
|
|
|
*/ |
30
|
|
|
protected $description = 'Foundation install command.'; |
31
|
|
|
|
32
|
|
|
/* ----------------------------------------------------------------- |
33
|
|
|
| Main Methods |
34
|
|
|
| ----------------------------------------------------------------- |
35
|
|
|
*/ |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Execute the console command. |
39
|
|
|
*/ |
40
|
|
|
public function handle() |
41
|
|
|
{ |
42
|
|
|
$this->arcanesoftHeader(); |
43
|
|
|
|
44
|
|
|
if ($this->confirm('Do you wish to publish the modules ?')) { |
45
|
|
|
$this->publishAllModules(); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
if ($this->confirm('Do you wish to reset the migrations ?')) { |
49
|
|
|
$this->refreshMigrations(); |
50
|
|
|
$this->installModules(); |
51
|
|
|
} |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/* ----------------------------------------------------------------- |
55
|
|
|
| Other Methods |
56
|
|
|
| ----------------------------------------------------------------- |
57
|
|
|
*/ |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Publish all modules: configs, migrations, assets ... |
61
|
|
|
*/ |
62
|
|
|
private function publishAllModules() |
63
|
|
|
{ |
64
|
|
|
$this->frame('Publishing all the modules files'); |
65
|
|
|
$this->line(''); |
66
|
|
|
|
67
|
|
|
$this->call('foundation:publish'); |
68
|
|
|
$this->call('optimize'); |
69
|
|
|
|
70
|
|
|
$this->comment('All files are published !'); |
71
|
|
|
$this->line(''); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Refresh migrations. |
76
|
|
|
*/ |
77
|
|
|
private function refreshMigrations() |
78
|
|
|
{ |
79
|
|
|
$this->frame('Reseting all the migrations'); |
80
|
|
|
$this->line(''); |
81
|
|
|
|
82
|
|
|
$this->call('migrate:fresh'); |
83
|
|
|
|
84
|
|
|
$this->line(''); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Seed all modules. |
89
|
|
|
*/ |
90
|
|
|
private function installModules() |
91
|
|
|
{ |
92
|
|
|
$this->frame('Installing the modules'); |
93
|
|
|
$this->line(''); |
94
|
|
|
|
95
|
|
|
foreach ($this->config()->get('arcanesoft.foundation.modules.commands.install', []) as $command) { |
96
|
|
|
$this->call($command); |
97
|
|
|
} |
98
|
|
|
$this->call('db:seed', ['--class' => DatabaseSeeder::class]); |
99
|
|
|
|
100
|
|
|
$this->line(''); |
101
|
|
|
$this->comment('Modules installed !'); |
102
|
|
|
$this->line(''); |
103
|
|
|
} |
104
|
|
|
} |
105
|
|
|
|