Skip to content

Commit

Permalink
Merge pull request #586 from nasirkhan/dev
Browse files Browse the repository at this point in the history
Reset Demo command
  • Loading branch information
nasirkhan committed May 15, 2024
2 parents 64045df + c1c2a0a commit ee2e346
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions app/Console/Commands/ResetDemo.php
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');
}
}

0 comments on commit ee2e346

Please sign in to comment.