I have installed and configured the laravel spatie media library. In the media table I have the first records which contain the first images.
I get this error in the console:
GET http://127.0.0.1:8000/storage/app/public/2/shot.png 404 (Not Found)
filesystems.php
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
'throw' => false,
],
'photo' => [
'driver' => 'local',
'root' => storage_path('app/public/photo'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
'throw' => false,
],
i used this command
php artisan storage:link
blade file
<img src="{{ url('storage/app/public/' . $media->id . '/' . $media->file_name) }}" alt="{{ $media->name }}">
and controller
$media = media::where('collection_name', 'photo')
->where('model_id', auth()->id())
->first();