When I upload images to a storage folder in my localhost, it works fine. However, when I move my Laravel 5.7 project to shared hosting the images don't appear, and I don't know why.
Thank you for your help.
Blade
@foreach ($data as $user)
@foreach(json_decode($user->name, true) as $images)
@endforeach
@endforeach
<!-- Wrapper for slides -->
<div class="carousel-inner">
@foreach ($data as $user)
@foreach(json_decode($user->name, true) as $images)
<div class="item">
<img src="{{ asset('/slider/images') }}/{{$images}}" alt="Los Angeles" style="width:100%;">
</div>
@endforeach
@endforeach
</div>
Controller
<?php
if ($request->hasfile('image')) {
foreach ($request->file('image') as $image) {
$name = $image->getClientOriginalName();
$image->move(storage_path() . '/slider/images/', $name);
$data[] = $name;
}
$query = DB::table('slider')->insert([
['title' => 'lorem', 'alt' => 'lorem', 'name' => json_encode($data)],
]);
return "good";
} else {
return "null";
}