Skip to content

Commit

Permalink
Display actual product image
Browse files Browse the repository at this point in the history
  • Loading branch information
iambasanta committed Jun 10, 2023
1 parent c53cc63 commit 2d2c694
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions app/Http/Controllers/Admin/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function index()
*/
public function create()
{
$categories = Category::orderBy('name')->get();
$categories = Category::where('is_visible', 1)->orderBy('name')->get();

return view('admin.products.create', compact('categories'));
}
Expand Down Expand Up @@ -55,7 +55,7 @@ public function show(string $id)
*/
public function edit(Product $product)
{
$categories = Category::orderBy('name')->get();
$categories = Category::where('is_visible', 1)->orderBy('name')->get();

return view('admin.products.edit', compact('categories','product'));
}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/frontend/cart.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@foreach( Cart::content() as $item )
<li class="flex py-6">
<div class="flex-shrink-0">
<img src="{{ $item->model->image }}" alt="Front side of sienna cotton t-shirt." class="h-24 w-24 rounded-md object-cover object-center sm:h-32 sm:w-32">
<img src="{{ $item->model->imageUrl() }}" alt="Front side of sienna cotton t-shirt." class="h-24 w-24 rounded-md object-cover object-center sm:h-32 sm:w-32">
</div>

<div class="ml-4 flex flex-1 flex-col sm:ml-6">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/frontend/home.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class="h-full w-full object-cover object-center">
@foreach( $products as $product )
<div class="group relative">
<div class="h-56 w-full overflow-hidden rounded-md group-hover:opacity-75 lg:h-72 xl:h-80">
<img src="{{ $product->image }}" alt="Product image" class="h-full w-full object-cover object-center">
<img src="{{ $product->imageUrl() }}" alt="Product image" class="h-full w-full object-cover object-center">
</div>
<h3 class="mt-4 text-sm text-gray-700">
<a href="{{ route('product.show', [$product->category, $product]) }}">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/frontend/orders/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<tr>
<td class="py-6 pr-8">
<div class="flex items-center">
<img src="{{ $product->image }}" alt="Detail of mechanical pencil tip with machined black steel shaft and chrome lead tip." class="mr-6 h-16 w-16 rounded object-cover object-center">
<img src="{{ $product->imageUrl() }}" alt="Detail of mechanical pencil tip with machined black steel shaft and chrome lead tip." class="mr-6 h-16 w-16 rounded object-cover object-center">
<div>
<div class="font-medium text-gray-900">{{ $product->name }}</div>
<div class="mt-1 sm:hidden">${{ $product->price }}</div>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/frontend/products/index.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<x-frontend.app title="Collections">
<div class="px-4 py-16 text-center sm:px-6 lg:px-8">
<div class="px-4 py-16 max-w-7xl mx-auto text-center sm:px-6 lg:px-8">
<h1 class="text-4xl font-bold tracking-tight text-gray-900">{{ $category->name }}</h1>
<p class="mx-auto mt-4 max-w-xl text-base text-gray-500">{!! $category->description !!}</p>
</div>
Expand Down
10 changes: 5 additions & 5 deletions resources/views/frontend/products/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@
<!-- Image gallery -->
<div class="mx-auto mt-6 max-w-2xl sm:px-6 lg:grid lg:max-w-7xl lg:grid-cols-3 lg:gap-x-8 lg:px-8">
<div class="aspect-h-4 aspect-w-3 hidden overflow-hidden rounded-lg lg:block">
<img src="{{ $product->image }}" alt="Two each of gray, white, and black shirts laying flat." class="h-full w-full object-cover object-center">
<img src="{{ $product->imageUrl() }}" alt="Product image" class="h-full w-full object-cover object-center">
</div>
<div class="hidden lg:grid lg:grid-cols-1 lg:gap-y-8">
<div class="aspect-h-2 aspect-w-3 overflow-hidden rounded-lg">
<img src="{{ $product->image }}" alt="Model wearing plain black basic tee." class="h-full w-full object-cover object-center">
<img src="{{ $product->imageUrl() }}" alt="Product image" class="h-full w-full object-cover object-center">
</div>
<div class="aspect-h-2 aspect-w-3 overflow-hidden rounded-lg">
<img src="{{ $product->image }}" alt="Model wearing plain gray basic tee." class="h-full w-full object-cover object-center">
<img src="{{ $product->imageUrl() }}" alt="Product image" class="h-full w-full object-cover object-center">
</div>
</div>
<div class="aspect-h-5 aspect-w-4 lg:aspect-h-4 lg:aspect-w-3 sm:overflow-hidden sm:rounded-lg">
<img src="{{ $product->image }}" alt="Model wearing plain white basic tee." class="h-full w-full object-cover object-center">
<img src="{{ $product->imageUrl() }}" alt="Product image" class="h-full w-full object-cover object-center">
</div>
</div>

Expand Down Expand Up @@ -224,7 +224,7 @@
@foreach($alsoPurchased as $product)
<div class="group relative">
<div class="min-h-80 aspect-h-1 aspect-w-1 w-full overflow-hidden rounded-md bg-gray-200 lg:aspect-none group-hover:opacity-75 lg:h-80">
<img src="{{ $product->image }}" alt="Front of men's Artwork Tee in peach with white and brown dots forming an isometric cube." class="h-full w-full object-cover object-center lg:h-full lg:w-full">
<img src="{{ $product->imageUrl() }}" alt="Front of men's Artwork Tee in peach with white and brown dots forming an isometric cube." class="h-full w-full object-cover object-center lg:h-full lg:w-full">
</div>
<div class="mt-4 flex justify-between">
<div>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/livewire/frontend/products/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
@foreach( $products as $product )
<div class="group relative flex flex-col overflow-hidden rounded-lg border border-gray-200 bg-white">
<div class="aspect-h-4 aspect-w-3 bg-gray-200 sm:aspect-none group-hover:opacity-75 sm:h-96">
<img src="{{ $product->image }}" alt="Eight shirts arranged on table in black, olive, grey, blue, white, red, mustard, and green." class="h-full w-full object-cover object-center sm:h-full sm:w-full">
<img src="{{ $product->imageUrl() }}" alt="Eight shirts arranged on table in black, olive, grey, blue, white, red, mustard, and green." class="h-full w-full object-cover object-center sm:h-full sm:w-full">
</div>
<div class="flex flex-1 flex-col space-y-2 p-4">
<h3 class="text-sm font-medium text-gray-900">
Expand Down

0 comments on commit 2d2c694

Please sign in to comment.