Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

Wotuu/keystone.guru

63 stars
1 code files
View Wotuu/keystone.guru on GitHub

app/Console/Commands/Environment/Update.php

Open in GitHub
use App\Console\Commands\Traits\ExecutesShellCommands;
use Illuminate\Console\Command;
 
class Update extends Command
{
use ExecutesShellCommands;
 
const COMPILE = [
'live' => true,
'local' => false,
'mapping' => true,
'staging' => true,
];
 
const COMPILE_AS = [
'live' => 'production',
'local' => 'dev',
'mapping' => 'production',
'staging' => 'dev',
];
 
public function handle()
{
$environment = $this->argument('environment');
 
// Regenerate IDE helper
$this->call('clear-compiled');
$this->call('ide-helper:generate');
$this->call('ide-helper:meta');
 
$this->call('horizon:publish');
 
$this->call('migrate', [
'--database' => 'migrate',
'--force' => true
]);
 
$this->call('modelCache:clear');
 
$this->call('db:seed', [
'--database' => 'migrate',
'--force' => true
]);
 
if ($environment === 'live') {
$this->call('make:githubrelease');
$this->shell([
'git pull',
]);
}
 
$this->shell([
'git tag | sort -V | (tail -n 1) > version',
self::COMPILE[$environment] ? sprintf('npm run %s -- --env.full true', self::COMPILE_AS[$environment]) : null,
]);
 
$this->call('optimize:clear');
if ($environment === 'live') {
$this->call('route:cache');
} else {
$this->call('route:clear');
}
$this->call('config:clear');
$this->call('queue:restart');
$this->call('supervisor:start');
 
$this->call('affixgroupeasetiers:refresh');
 
return 0;
}
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.