默认情况下,Voyager会将图像上传到storage / app / public / posts文件夹,以便发布帖子的精选图片。 我想将其更改为公用文件夹中的自定义文件夹。
我如何实现这一目标?
提前致谢。
答案 0 :(得分:2)
打开command not found
文件并查看this部分。再添加一个密钥,例如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',
],
],
file并设置该密钥(config/voyager.php
),而不是' public'像这样:
'voyager'
答案 1 :(得分:0)
转到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',
],