-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCloneProjectSetup.php
62 lines (52 loc) · 1.46 KB
/
CloneProjectSetup.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
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class CloneProjectSetup extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'clone';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Prepare project before run application.';
/**
* Execute the console command.
*/
public function handle(): void
{
$count = 3;
$bar = $this->output->createProgressBar($count);
$this->newLine(1);
$bar->start();
$this->newLine(1);
/*
- Step 1- Copy .env.sample .env
*/
exec('cp .env.example .env', $output2);
$this->newLine(1);
$this->comment(implode(PHP_EOL, $output2));
$bar->advance();
$this->newLine(1);
/*
- Step 2 - Generate key
*/
$this->call('key:generate');
$bar->advance();
$this->newLine(1);
// Step 3 - Clear cache
$this->call('optimize:clear');
$this->call('config:clear');
$bar->advance();
$this->newLine(1);
$bar->finish();
$this->newLine(1);
$this->info(" \n ✅ Prepare project before run application successfully 🎉🎉💥" . PHP_EOL);
$this->info(" \n ==> Please edit .env to connect database and run ``php artisan migrate:fresh --seed``" . PHP_EOL);
}
}