mirror of
https://github.com/superhelio/commands.git
synced 2026-02-02 20:47:53 +00:00
Initial commit, superhelio:reload
This commit is contained in:
60
src/Commands/Reload.php
Normal file
60
src/Commands/Reload.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace Superhelio\Commands\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class Reload extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'superhelio:reload';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Delete database tables, migrate and run seeds';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if ($this->confirm('Rollback all your database tables, recreate them and seed?')) {
|
||||
$this->call(
|
||||
'migrate:reset',
|
||||
[
|
||||
'--no-interaction' => true,
|
||||
'--env' => 'development',
|
||||
'--verbose' => 3
|
||||
]
|
||||
);
|
||||
$this->call(
|
||||
'migrate',
|
||||
[
|
||||
'--seed' => true,
|
||||
'--no-interaction' => true,
|
||||
'--env' => 'development',
|
||||
'--verbose' => 3
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
13
src/Facade.php
Normal file
13
src/Facade.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
namespace Superhelio\Commands;
|
||||
|
||||
class Facade extends \Illuminate\Support\Facades\Facade
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'commands';
|
||||
}
|
||||
}
|
||||
42
src/ServiceProvider.php
Normal file
42
src/ServiceProvider.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Superhelio\Commands;
|
||||
|
||||
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
|
||||
|
||||
/**
|
||||
* Class PackageServiceProvider
|
||||
*
|
||||
* @package Superhelio\Commands
|
||||
* @see http://laravel.com/docs/master/packages#service-providers
|
||||
* @see http://laravel.com/docs/master/providers
|
||||
*/
|
||||
class ServiceProvider extends BaseServiceProvider
|
||||
{
|
||||
/**
|
||||
* Indicates if loading of the provider is deferred.
|
||||
*
|
||||
* @see http://laravel.com/docs/master/providers#deferred-providers
|
||||
* @var bool
|
||||
*/
|
||||
protected $defer = false;
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @see http://laravel.com/docs/master/providers#the-register-method
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->registerReloader();
|
||||
}
|
||||
|
||||
private function registerReloader()
|
||||
{
|
||||
$this->app->singleton('command.superhelio.reload', function ($app) {
|
||||
return $app['Superhelio\Commands\Commands\Reload'];
|
||||
});
|
||||
$this->commands('command.superhelio.reload');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user