简体   繁体   English

如何在laravel中将域的存储路径链接到子域

[英]How to link storage path of domain to sub domain in laravel

I have two laravel project on shared hosting one admin panel and another website .我有两个关于共享托管一个管理面板和另一个网站的 laravel 项目。 main site is on /public_html directory and another on /portal directory .主站点位于/public_html 目录,另一个位于/portal 目录

-----(/home/onomy)
     +portal
       |-subdomain laravel project
     +public_html
       |- domain laravel project

All the file need to fetched and upload in /public_html laravel project directory where main site is hosted.所有文件都需要在主站点托管的 /public_html laravel 项目目录中获取并上传。

like main site :example.com located at public_html like admin site at admin.example.com when i upload file from admin.example.com file should stored in example.com storage_path and also fetched from example.com storage_path.就像位于 public_html 的主站点:example.com 当我从 admin.example.com 文件上传文件时,位于 admin.example.com 的管理站点应该存储在 example.com storage_path 并从 example.com storage_path 获取。

Where should i change to map domain storage to subdomain storage我应该在哪里更改以将域存储映射到子域存储

how can i do that, is any change on config/filesystem.php or config/path.php我该怎么做, config/filesystem.phpconfig/path.php是否有任何更改

I am new in laravel, please help.我是laravel的新手,请帮忙。

In your subdomain project you could create a new "disk" in config/filesystem.php :在您的子域项目中,您可以在config/filesystem.php中创建一个新的“磁盘”:

'public_html' => [
    'driver' => 'local',
    'root' => '/home/onomy/public_html/storage',
    'url' => env('PUBLIC_URL').'/storage', // should point to your main project
    'visibility' => 'public',
],

You should do then all file operations through this disk.然后,您应该通过此磁盘执行所有文件操作。 Hope I got your question right and this helps.希望我的问题是正确的,这会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM