Last active
August 29, 2015 14:10
-
-
Save joycse06/c03da3aaa31e416cfb0f to your computer and use it in GitHub Desktop.
Artisan Startover Command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Console\Command; | |
use Symfony\Component\Console\Input\InputOption; | |
use Symfony\Component\Console\Input\InputArgument; | |
class StartOverCommand extends Command { | |
/** | |
* The console command name. | |
* | |
* @var string | |
*/ | |
protected $name = 'appname:startover'; | |
/** | |
* The console command description. | |
* | |
* @var string | |
*/ | |
protected $description = 'Reset Migration, remigrate, seed data and Start Over'; | |
/** | |
* Create a new command instance. | |
* | |
* @return void | |
*/ | |
public function __construct() | |
{ | |
parent::__construct(); | |
} | |
/** | |
* Execute the console command. | |
* | |
* @return mixed | |
*/ | |
public function fire() | |
{ | |
$this->info("Resetting the Migration....."); | |
$this->call('migrate:reset'); | |
$this->info("Recreating schemas...."); | |
$this->call('migrate'); | |
$this->info('Seeding data.....'); | |
$this->call('db:seed'); | |
} | |
/** | |
* Get the console command arguments. | |
* | |
* @return array | |
*/ | |
protected function getArguments() | |
{ | |
return array( | |
); | |
} | |
/** | |
* Get the console command options. | |
* | |
* @return array | |
*/ | |
protected function getOptions() | |
{ | |
return array( | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment