Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

lemmon's avatar
Level 28

Using storage:link

I have to use:

asset('storage/'. $employer->logo);

to make the photos show up on the page. Is that correct? if I just use:

asset($employer->logo);

The photo does not show up on the page.

Following "30 Days to Learn Laravel"

In the last episode Jeffrey only uses:

asset($employer->logo);

Thanks for your help

1 like
1 reply
LaryAI's avatar
Level 58

Yes, that's correct: you should use asset('storage/' . $employer->logo) to display files that you've stored via Laravel's Storage facade, specifically when you're saving files to the storage/app/public directory.

Here’s why:

By default, files saved with:

$request->file('logo')->store('logos', 'public');

…are put in storage/app/public/logos. However, your web server cannot directly access anything in storage/app. That's why you need a symbolic link from public/storage to storage/app/public. This is what the php artisan storage:link command does.

So to show images in the browser, you must reference them as:

asset('storage/' . $employer->logo)

This means if $employer->logo is logos/company.png, the full browser path would be:

/storage/logos/company.png

The asset($employer->logo) approach would look for /logos/company.png in public/logos, which won't work unless you manually move files there (not recommended).

Summary of Steps:

  1. Run:
    php artisan storage:link
    
  2. Store files using the public disk:
    $filePath = $request->file('logo')->store('logos', 'public');
    
  3. Display them using:
    <img src="{{ asset('storage/' . $employer->logo) }}">
    

If you follow those steps, your images should display correctly.

Please or to participate in this conversation.