Example #1
0
 public function run($executed)
 {
     if (!Config::get('app.dbBackup')) {
         return;
     }
     $dump = new MySqlDump();
     $con = Config::get('database.connections.mysql');
     $dateTime = date('M-d-Y_H-i');
     $filename = storage_path() . '/database/' . $dateTime . '.sql';
     $dump->host = $con['host'];
     $dump->user = $con['username'];
     $dump->pass = $con['password'];
     $dump->db = $con['database'];
     $dump->filename = $filename;
     $dump->start();
 }
 /**
  * Create MySQL dump
  * 
  * @return void
  */
 public function getExport()
 {
     if (!$this->checkAccessRead()) {
         return;
     }
     switch (Config::get('database.default')) {
         // retrieve the default database type from the config
         case 'mysql':
             $dump = new MySqlDump();
             $con = Config::get('database.connections.mysql');
             $dateTime = date('M-d-Y_H-i');
             $filename = storage_path() . '/database/' . $dateTime . '.sql';
             $dump->host = $con['host'];
             $dump->user = $con['username'];
             $dump->pass = $con['password'];
             $dump->db = $con['database'];
             $dump->filename = $filename;
             $dump->start();
             $this->alertSuccess(trans('config::db_export'), trans('config::db_file', [$filename]));
             break;
         default:
             $this->alertError(trans('config::not_supported', [Config::get('database.default')]));
             return;
     }
 }