C
C
Creed12342021-02-17 10:36:33
Laravel
Creed1234, 2021-02-17 10:36:33

Why does laravel get 403 error when using asset?

I am using laravel asset helper to display image.

<td><img src="{{ asset('assets/far/img/product/' . $item['img']) }}" height="50px" alt=""></td>


$item['img'] получаю из сессии 
@foreach( session()->get('cart') as $item)


The image is loading, but a 403 error is thrown.
On other pages, everything is ok (if I get it not from the session) with the session everything is the same.
If I pull out the picture immediately in public
<td><img src="{{ asset('/' . $item['img']) }}" height="50px" alt=""></td>


the error disappears.

I understand that there is a problem with accessing files, but I do not know how to solve it.

Here is my filesystem.php

'disks' => [

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

    'public' => [
        'driver' => 'local',
        'root' => storage_path('app/public'),
        'url' => env('APP_URL').'/public',
        'visibility' => 'public',
    ],

    's3' => [
        'driver' => 's3',
        'key' => env('AWS_ACCESS_KEY_ID'),
        'secret' => env('AWS_SECRET_ACCESS_KEY'),
        'region' => env('AWS_DEFAULT_REGION'),
        'bucket' => env('AWS_BUCKET'),
        'url' => env('AWS_URL'),
        'endpoint' => env('AWS_ENDPOINT'),
    ],

],

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


Why is that ?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question