mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-28 12:11:08 -04:00
fix reset-app
This commit is contained in:
@ -3,17 +3,20 @@
|
|||||||
namespace Crater\Console\Commands;
|
namespace Crater\Console\Commands;
|
||||||
|
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Console\ConfirmableTrait;
|
||||||
use Illuminate\Support\Facades\Artisan;
|
use Illuminate\Support\Facades\Artisan;
|
||||||
use Illuminate\Filesystem\Filesystem;
|
use Illuminate\Filesystem\Filesystem;
|
||||||
|
|
||||||
class ResetApp extends Command
|
class ResetApp extends Command
|
||||||
{
|
{
|
||||||
|
use ConfirmableTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name and signature of the console command.
|
* The name and signature of the console command.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $signature = 'reset:app';
|
protected $signature = 'reset:app {--force}';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The console command description.
|
* The console command description.
|
||||||
@ -39,13 +42,28 @@ class ResetApp extends Command
|
|||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
if ($this->confirm('Do you wish to continue? This will delete your tables')) {
|
if (!$this->confirmToProceed()) {
|
||||||
Artisan::call('migrate:reset --force');
|
return;
|
||||||
|
|
||||||
\Storage::disk('local')->delete('database_created');
|
|
||||||
|
|
||||||
// $file = new Filesystem;
|
|
||||||
// $file->cleanDirectory('public/storage');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->info('Running migrate:fresh');
|
||||||
|
|
||||||
|
Artisan::call('migrate:fresh --seed --force');
|
||||||
|
|
||||||
|
$this->info('Seeding database');
|
||||||
|
|
||||||
|
Artisan::call('db:seed', ['--class' => 'DemoSeeder', '--force' => true]);
|
||||||
|
|
||||||
|
$path = base_path('.env');
|
||||||
|
|
||||||
|
if (file_exists($path)) {
|
||||||
|
file_put_contents($path, str_replace(
|
||||||
|
'APP_DEBUG=true',
|
||||||
|
'APP_DEBUG=false',
|
||||||
|
file_get_contents($path)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->info('App has been reset successfully');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user