Search code examples
phplaravelenvironment-variableslaravel-5.3assets

How can I get image from different project on the laravel?


I have two project or url

First url like this :

http://myshop.dev/

Second url like this :

http://backend.myshop.dev/

If the second url, I run this :

<img src="{{ asset('img/$photo }}"/>

It will call url :

http://backend.myshop.dev/img/image1.jpg

It did not suit my needs

I want to take the image in the first url (http://myshop.dev/img/image1.jpg)

Both projects use the same database

How can I do it?


Solution

  • Add this to your .env

    BACKEND_URL=http://backend.myshop.dev/public/
    

    Call

    <img src="{{ env('BACKEND_URL') . "{img/$photo}"}}"/>