-
Notifications
You must be signed in to change notification settings - Fork 429
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #586 from nasirkhan/dev
Reset Demo command
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Illuminate\Support\Facades\Artisan; | ||
|
||
class ResetDemo extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'app:reset-demo'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Reset the demo site.'; | ||
|
||
/** | ||
* Execute the console command. | ||
*/ | ||
public function handle() | ||
{ | ||
$demo_mode = config('app.demo_mode'); | ||
|
||
if ($demo_mode == true) { | ||
$this->warn("\n\n Demo Mode is ON \n"); | ||
|
||
$this->resetDemoData(); | ||
} else { | ||
$this->warn("\n\n Demo Mode is OFF \n"); | ||
} | ||
} | ||
|
||
public function resetDemoData() | ||
{ | ||
$this->info('Reset Database and migrate fresh'); | ||
Artisan::call('migrate:fresh'); | ||
|
||
$this->info('Reset Database seeds'); | ||
Artisan::call('db:seed'); | ||
|
||
$this->info('Insert Demo Data again'); | ||
Artisan::call('laravel-starter:insert-demo-data'); | ||
} | ||
} |