【问题标题】:Specify destination directory for Laravel Spatie backup指定 Laravel Spatie 备份的目标目录
【发布时间】:2021-06-29 05:05:06
【问题描述】:

我正在使用Laravel Spatie Backup 来备份我的 Laravel 项目。现在备份存储在myproject/storage/app 目录中。如何将此目录更改为例如myproject/storage/app/some/directory? 我找不到明确的答案。

我现在的laravel-backup.php 配置:

'destination' => [

    /*
     * The disk names on which the backups will be stored.
     */
    'disks' => [
        'local'
    ],
],

我尝试了以下操作:'local' => '/some/directory' 但这会引发错误 Copying .zip file failed because: Could not connect to disk /some/directory because the disk is not set..

【问题讨论】:

  • 如果你确定路径存在,你可以设置目标文件名前缀来包含路径
  • 或者您可以在 config/file 中使用正确的后缀创建一个新配置并使用它...

标签: php laravel


【解决方案1】:

先去config/filesystems.php

为您的项目添加新磁盘

  'disks' => [

        'local' => [
            'driver' => 'local',
            'root' => storage_path('app'),
        ],


        // add your own disk to the project
        'localBackup' => [
            'driver' => 'local',
            'root' => storage_path('app/your_directory') // your folder,
        ],

        ....
  ]

在 config/backup.php 中

 'destination' => [

            /*
             * The filename prefix used for the backup zip file.
             */
            'filename_prefix' => 'backup_',

            /*
             * The disk names on which the backups will be stored.
             */
            'disks' => [
                'localBackup',//your disk
            ],
        ],

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-04-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-24
    • 1970-01-01
    • 1970-01-01
    • 2021-02-16
    相关资源
    最近更新 更多