'How to configure filesystems to send images from one Laravel application to another?

My application consists of two different laravel applications.

One, (APP-A) is the front end for users.

Another (APP-B) is the backoffice, used only by content managers.

Both consume the same database.

The problem to be solved has to do with the storage of images and other files.

During development, I want to store the images in APP-B storage.

For this, I need to send the images from APP-A to APP-B and perform the other applicable CRUD operations.

How should I configure filesystems.php for this purpose? Do I have to do it in APP-A and APP-B filesystems? And file .env?

EDITED 17/03

APP-B (backoffice)

Folders: Storage/uploadFiles/images

filesystems.php

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

'links' => [
    public_path('uploadFiles') => storage_path('app/uploadFiles')
],

On APP-B controllers to read images from APP-B storage

$url = asset('images/');

On APP-A (Front End for users)

.env file

ASSET_URL= http://my_app.dv/uploadFiles/

Note: php artisan config:clear required

For read images stored in APP-B from APP-A controller , just:

$url = asset('images') 

It works.

Problem to solve: store a image in APP-B storage from a APP-A controller

$file = $request->file('file');
$path = $file->store('images');

This will store in APP-A instead of App-B as desired. How to solve this (for development purposes only)?



Solution 1:[1]

You can set up AWS S3 for both applications and use the same key in both applications to access the same bucket. Result: Both applications uses the same "storage directory".

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Andrew Larsen