Beispiel #1
0
 /**
  * @return bool
  */
 protected function _backupServiceUsers()
 {
     $_backupPath = base_path() . DIRECTORY_SEPARATOR . 'database' . DIRECTORY_SEPARATOR . 'dfe';
     if (!Disk::ensurePath($_backupPath)) {
         $this->writeln('Unable to write to backup path <comment>' . $_backupPath . '</comment>. Aborting.', 'error');
         return false;
     }
     $_users = [];
     /** @type ServiceUser $_user */
     foreach (ServiceUser::all() as $_user) {
         $_users[] = $_user->toArray();
     }
     JsonFile::encodeFile($_backupPath . DIRECTORY_SEPARATOR . 'service-user.backup.' . date('YmdHis') . '.json', $_users);
     return true;
 }