I have a blog project created using Laravel, It works fine on my localhost, I uploaded the project and converted it to work on a shared host, and this is not my first time doing this, after uploading the project and the database, Everything works fine, I mean when opening the blog I can see my posts (WITH PICTURES) and categories and everything, BUT in the Voyager CPanel I can't see images, so I picked the admin logo as an example, In the database it contains this name (settings/January2018/PnrVRpff94865gfxeZ0gt.png
) and the Voyager sideBar Blade code for this image is this :
<?php $admin_logo_img = Voyager::setting('admin_icon_image', ''); ?>
@if($admin_logo_img == '')
<img src="{{ voyager_asset('images/logo-icon-light.png') }}" alt="Logo Icon">
@else
<img src="{{ Voyager::image($admin_logo_img) }}" alt="Logo Icon">
@endif
and the result on chrome is this :
<img src="" alt="Logo Icon">
So I went to the Voyager::image()
function :
public function image($file, $default = '')
{
if (!empty($file) && Storage::disk(config('voyager.storage.disk'))->exists($file)) {
return Storage::disk(config('voyager.storage.disk'))->url($file);
}
return $default;
}
And I did my tests and here is the results in this logo case :
empty($file)
Return False (Good)
Storage::disk(config('voyager.storage.disk'))->exists($file)
Return False (Bad)
Storage::disk(config('voyager.storage.disk'))->url($file)
Return the Correct URL (Good)
Knowing that config('voyager.storage.disk')
Return "public" and the filesystems disks config is untouched.
As you see the problem in the Voyager::image()
Function, So please help me solve this problem in the right way.
Update :
I tried changing the Voyager::image() function in the /vendor/tcg/voyager/src folder To :
public function image($file, $default = '')
{
//Bad Solution
return Storage::disk(config('voyager.storage.disk'))->url($file);
}
and it worked so well, but as you see it's a bad solution, And I need a right one, So please help.