LARAVEL - Sharing images between projects

1

I have several Laravel projects on the same server. I often need to use employee photos and, as I have programmed it, I copy the photos from the public/assets/ images directory of an existing project into the same directory as the developing project, causing a very large increase of duplicate files. Is there a way to share photos between projects or have a common repository?

I saw a feature in Laravel, which is the use of 'symbolick link', but I did not quite understand how to do it.

Below, I give an example of the idea that I am trying to approach, not knowing if this is the way. The code is from the developing project, needing to take the photo path of another existing project, using the word pathFile as this note:

<tr>
  <td>
    <img src='+caminhoArquivo+'+retorno[i].foto+'" style="width:50%;height:auto;" />
  </td>
 </tr>

Would it be possible?

    
asked by anonymous 24.05.2017 / 15:13

1 answer

2

In fact, Laravel's native symbolic link is for mapping a single project directory.

What you can do is create a default directory in your file structure, and make a symbolic link to this directory in a subfolder of storage/app of each of the projects, something like this:

mkdir /var/www/shared-files
cd /var/www/prj-1/storage
mkdir app/files
ln -s /var/www/shared-files/* app/files
cd /var/www/prj-2/storage
app/files
ln -s /var/www/shared-files/* app/files

And so on in each of the projects.

    
24.05.2017 / 19:18