1

默认情况下,Voyager 会将图像上传到 storage/app/public/posts 文件夹以获取帖子的特色图像。我想将其更改为我的公用文件夹中的自定义文件夹。

我如何实现这一目标?

提前致谢。

4

2 回答 2

3

打开config/filesystems.php文件并检查部分。再添加一个键voyager,例如。

'disks' => [
    'local' => [
        'driver' => 'local',
        'root' => storage_path('app'),
    ],
    'public' => [
        'driver' => 'local',
        'root' => storage_path('app/public'),
        'url' => env('APP_URL').'/storage',
        'visibility' => 'public',
    ],
    's3' => [
        'driver' => 's3',
        'key' => env('AWS_ACCESS_KEY_ID'),
        'secret' => env('AWS_SECRET_ACCESS_KEY'),
        'region' => env('AWS_DEFAULT_REGION'),
        'bucket' => env('AWS_BUCKET'),
    ],
    'voyager' => [
        'driver' => 'local',
        'root' => storage_path('app/public'),// change here something specific to your application need
        'url' => env('APP_URL').'/storage',
        'visibility' => 'public',
    ],
],

然后打开config/voyager.php 文件并设置该密钥('voyager')而不是像这样的“公共”:

'storage' => [
    'disk' => 'voyager',
],
于 2017-11-23T09:45:30.210 回答
1

转到 config/filesystems.php 并更改新文件夹的根目录和 URL 密钥。请参阅下面的示例

    'public' => [
        'driver' => 'local',
        'root' => public_path().'/app', //Add new folder into public folder called app
        'url' => env('APP_URL').'/public/app', //change get path for image 
        'visibility' => 'public',
    ],
于 2019-10-21T07:19:29.777 回答