File manager - Edit - /var/www/html/portal/app/Console/Commands/DatabaseRestoreCommand.php
Back
<?php namespace App\Console\Commands; use Illuminate\Console\Command; use Illuminate\Support\Facades\DB; class DatabaseRestoreCommand extends Command { protected $signature = 'db:restore {path : Caminho para o arquivo .sql}'; protected $description = 'Restaura o banco a partir de um arquivo SQL local'; public function handle(): int { $path = $this->argument('path'); if (!file_exists($path)) { $this->error('Arquivo não encontrado: '.$path); return 1; } try { $sql = file_get_contents($path); DB::unprepared($sql); $this->info('Restauração concluída com sucesso.'); return 0; } catch (\Exception $e) { $this->error('Falha ao restaurar: '.$e->getMessage()); return 1; } } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.07 |
proxy
|
phpinfo
|
Settings