mirror of
				https://github.com/crater-invoice/crater.git
				synced 2025-10-30 21:21:09 -04:00 
			
		
		
		
	fix reset-app
This commit is contained in:
		| @ -3,17 +3,20 @@ | ||||
| namespace Crater\Console\Commands; | ||||
|  | ||||
| use Illuminate\Console\Command; | ||||
| use Illuminate\Console\ConfirmableTrait; | ||||
| use Illuminate\Support\Facades\Artisan; | ||||
| use Illuminate\Filesystem\Filesystem; | ||||
|  | ||||
| class ResetApp extends Command | ||||
| { | ||||
|     use ConfirmableTrait; | ||||
|  | ||||
|     /** | ||||
|      * The name and signature of the console command. | ||||
|      * | ||||
|      * @var string | ||||
|      */ | ||||
|     protected $signature = 'reset:app'; | ||||
|     protected $signature = 'reset:app {--force}'; | ||||
|  | ||||
|     /** | ||||
|      * The console command description. | ||||
| @ -39,13 +42,28 @@ class ResetApp extends Command | ||||
|      */ | ||||
|     public function handle() | ||||
|     { | ||||
|         if ($this->confirm('Do you wish to continue? This will delete your tables')) { | ||||
|             Artisan::call('migrate:reset --force'); | ||||
|  | ||||
|             \Storage::disk('local')->delete('database_created'); | ||||
|  | ||||
|             // $file = new Filesystem; | ||||
|             // $file->cleanDirectory('public/storage'); | ||||
|         if (!$this->confirmToProceed()) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         $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