I have create an app that need to upload image.
I use http://laravel-admin.org/
already setup all and follow the documentation. All work, but my image cannot access via url
its said 404 - Not Found
when access via url.
checked on explorer its already there.
here my config/filesystems.php
....
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
'admin' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'visibility' => 'public',
'url' => env('APP_URL').'/storage',
],
....
here my config/admin.php
....
'upload' => [
'disk' => 'admin',
'directory' => [
'image' => 'images',
'file' => 'files',
],
'host' => 'http://localhost:8000/upload/',
],
....
any can help and explain, got stuck about 3 hours :')
ref your explorer screen, so the image is stored in public disk
/images
the easy way is access it by Storage::disk('public')->url('images/'. $image);
if you want create another disk, i can post more code
also you can use Accessor, in your model add this
public function getShowImageAttribute()
{
return \Storage::disk('public')->url('images/'. $this->attributes['image_column_name_here']);
}
so you can access it in the blade like this
{{ $user->show_image }}