Replace GrahamCampbell/Core with core code. Closes #2669

This commit is contained in:
James Brooks
2018-06-17 09:40:09 +01:00
parent 37a5d8f1a6
commit ce3ab9d3eb
7 changed files with 325 additions and 2 deletions

View File

@@ -69,6 +69,15 @@ class CommandSubscriber
$events->listen('command.installing', __CLASS__.'@fireInstallingCommand', 5);
$events->listen('command.updating', __CLASS__.'@fireUpdatingCommand', 5);
$events->listen('command.resetting', __CLASS__.'@fireResettingCommand', 5);
$events->listen('command.generatekey', __CLASS__.'@onGenerateKey');
$events->listen('command.cacheconfig', __CLASS__.'@onCacheConfig');
$events->listen('command.cacheroutes', __CLASS__.'@onCacheRoutes');
$events->listen('command.publishvendors', __CLASS__.'@onPublishVendors');
$events->listen('command.resetmigrations', __CLASS__.'@onResetMigrations');
$events->listen('command.runmigrations', __CLASS__.'@onRunMigrations');
$events->listen('command.runseeding', __CLASS__.'@onRunSeeding');
$events->listen('command.linkstorage', __CLASS__.'@onLinkStorage');
$events->listen('command.updatecache', __CLASS__.'@onUpdateCache');
}
/**
@@ -158,4 +167,116 @@ class CommandSubscriber
$command->line('Backup completed!');
}
/**
* Handle a command.generatekey event.
*
* @param \Illuminate\Console\Command $command
*
* @return void
*/
public function onGenerateKey(Command $command)
{
$command->call('key:generate');
}
/**
* Handle a command.cacheconfig event.
*
* @param \Illuminate\Console\Command $command
*
* @return void
*/
public function onCacheConfig(Command $command)
{
$command->call('config:cache');
}
/**
* Handle a command.cacheroutes event.
*
* @param \Illuminate\Console\Command $command
*
* @return void
*/
public function onCacheRoutes(Command $command)
{
$command->call('route:cache');
}
/**
* Handle a command.publishvendors event.
*
* @param \Illuminate\Console\Command $command
*
* @return void
*/
public function onPublishVendors(Command $command)
{
$command->call('vendor:publish');
}
/**
* Handle a command.resetmigrations event.
*
* @param \Illuminate\Console\Command $command
*
* @return void
*/
public function onResetMigrations(Command $command)
{
$command->call('migrate:reset', ['--force' => true]);
}
/**
* Handle a command.runmigrations event.
*
* @param \Illuminate\Console\Command $command
*
* @return void
*/
public function onRunMigrations(Command $command)
{
$command->call('migrate', ['--force' => true]);
}
/**
* Handle a command.runseeding event.
*
* @param \Illuminate\Console\Command $command
*
* @return void
*/
public function onRunSeeding(Command $command)
{
$command->call('db:seed', ['--force' => true]);
}
/**
* Handle a command.linkstorage event.
*
* @param \Illuminate\Console\Command $command
*
* @return void
*/
public function onLinkStorage(Command $command)
{
if ($command->getApplication()->has('storage:link')) {
$command->call('storage:link');
}
}
/**
* Handle a command.updatecache event.
*
* @param \Illuminate\Console\Command $command
*
* @return void
*/
public function onUpdateCache(Command $command)
{
$command->line('Clearing cache...');
$command->call('cache:clear');
$command->info('Cache cleared!');
}
}