Skip to content

Commit

Permalink
Fix the cover image url
Browse files Browse the repository at this point in the history
  • Loading branch information
jsdecena committed Jun 6, 2022
1 parent e6c4def commit 1159848
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion project/app/Shop/Products/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Product extends Model implements Buyable
'CENTIMETER' => 'cm',
'METER' => 'mtr',
'INCH' => 'in',
'MILIMETER' => 'mm',
'MILLIMETER' => 'mm',
'FOOT' => 'ft',
'YARD' => 'yd'
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protected function transformProduct(Product $product)
$prod->sku = $product->sku;
$prod->slug = $product->slug;
$prod->description = $product->description;
$prod->cover = asset("storage/$product->cover");
$prod->cover = $product->cover ? asset("storage/$product->cover") : null;
$prod->quantity = $product->quantity;
$prod->price = $product->price;
$prod->status = $product->status;
Expand Down
3 changes: 3 additions & 0 deletions project/resources/views/admin/products/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,16 @@
<label for="description">Description </label>
<textarea class="form-control ckeditor" name="description" id="description" rows="5" placeholder="Description">{!! $product->description !!}</textarea>
</div>
@if(!is_null($product->cover))
<div class="form-group">
<div class="col-md-3">
<div class="row">
<img src="{{ $product->cover }}" alt="" class="img-responsive img-thumbnail">
<a onclick="return confirm('Are you sure?')" href="{{ route('admin.product.remove.image', ['product_id' => $product->id]) }}" class="btn btn-danger btn-sm btn-block">Remove?</a><br />
</div>
</div>
</div>
@endif
<div class="row"></div>
<div class="form-group">
<label for="cover">Cover <span class="text-danger">*</span></label>
Expand Down

0 comments on commit 1159848

Please sign in to comment.