Products Seeding I'm trying to Seed products but it don't show the images at all and i tried some seeders that works with me in another project but not working in this one
also it inserts the image link in the DB
public function run()
{
DB::table('products')->insert([
'name' => 'Shirt',
'price' => 100,
'category_id' => 1,
'image'=>'https://i.ebayimg.com/images/g/wHIAAOSw37Baca9i/s-l500.jpg',
],
);
How is it not working?
it inserts the image link in the DB
What do you expect it to do?
@Sinnbeck the image is not showing in the project its not preveiwed
@karimali1337 The image isn't shown where? In the database? In a blade view?
@Sinnbeck in the blade view, name , price are shown normal but the image is empty
@karimali1337 How does the code look? If I understood you correct, the url is correctly in the database ?
@Sinnbeck yes the url saved in the DB normal but the image is not shown and if i tried to insert the product manually the image shown.
@karimali1337 So the above code works, but some code you have not shown does not, and you need help with the code you have not shown?
@Sinnbeck actually i don't know where's the mistake yet.
Welll the URL is working, so it might be handy to show your blade file.
Is this possible?
<div class="row">
@foreach ($products as $product )
@if ($product->category_id == 1)
<div class="col-lg-3 col-md-6 col-sm-12">
<div class="product-grid">
<div class="product-image">
<a href="#" class="image">
<img class="pic-1" src="{{URL::asset('Products')}}/{{$product->image}}">
</a>
<div class="price"> {{$product->price}} </div>
<form action="">
<a href="{{ url('add-to-cart/'.$product->id) }}" class="add-to-cart"> add to cart </a>
</form>
</div>
<div class="product-content">
<h3 class="title"><a href="#">{{$product->name}} </a></h3>
<ul class="rating">
<li class="fas fa-star"></li>
<li class="fas fa-star"></li>
<li class="fas fa-star"></li>
<li class="fas fa-star"></li>
<li class="fas fa-star"></li>
</ul>
</div>
</div>
</div>
@else
@endif
@endforeach
</div>
</div>
@karimali1337 You are saving an absolute url in the database, but you are adding your own url in front
<img class="pic-1" src="{{$product->image}}">
Please sign in or create an account to participate in this conversation.