-
Notifications
You must be signed in to change notification settings - Fork 554
/
Setup.php
63 lines (51 loc) · 1.56 KB
/
Setup.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
<?php
namespace A17\Twill\Commands;
use File;
use Illuminate\Console\Command;
class Setup extends Command
{
protected $signature = 'twill:setup';
protected $description = 'Setup Twill superadmin and publish configs';
public function handle()
{
$this->publishMigrations();
$this->call('migrate');
$this->publishConfig();
$this->createSuperAdmin();
}
private function publishMigrations()
{
$defaultMigrations = [
'2014_10_12_000000_create_users_table.php',
'2014_10_12_100000_create_password_resets_table.php',
];
foreach ($defaultMigrations as $migration) {
$fullPath = database_path('migrations/' . $migration);
if (File::exists($fullPath)) {
File::delete($fullPath);
}
}
$this->call('vendor:publish', [
'--provider' => 'A17\Twill\TwillServiceProvider',
'--tag' => 'migrations',
]);
$this->call('vendor:publish', [
'--provider' => 'Spatie\Activitylog\ActivitylogServiceProvider',
'--tag' => 'migrations',
]);
}
private function createSuperAdmin()
{
$this->call('twill:superadmin');
}
private function publishConfig()
{
$this->call('vendor:publish', [
'--provider' => 'A17\Twill\TwillServiceProvider',
'--tag' => 'config',
]);
$this->call('vendor:publish', [
'--provider' => "Dimsav\Translatable\TranslatableServiceProvider",
]);
}
}