Wishlist And Some Code Enhanced

This commit is contained in:
devansh bawari 2021-02-12 17:37:53 +05:30
parent 1efb44c947
commit 1840b804db
2 changed files with 13 additions and 13 deletions

View File

@ -43,9 +43,9 @@ class Wishlist
}
if ($wishlist) {
return true;
return $wishlist;
}
return false;
return null;
}
}

View File

@ -4,22 +4,22 @@
@auth('customer')
@php
$isWished = $wishListHelper->getWishlistProduct($product);
/* search wishlist on the basis of product's id so that wishlist id can be catched */
$wishlist = $wishListHelper->getWishlistProduct($product);
/* link making */
$href = isset($route) ? $route : ($wishlist ? route('customer.wishlist.remove', $wishlist->id) : route('customer.wishlist.add', $product->product_id));
/* title */
$title = $wishlist ? __('velocity::app.shop.wishlist.remove-wishlist-text') : __('velocity::app.shop.wishlist.add-wishlist-text');
@endphp
<a
class="unset wishlist-icon {{ $addWishlistClass ?? '' }} text-right"
@if(isset($route))
href="{{ $route }}"
@elseif (! $isWished)
href="{{ route('customer.wishlist.add', $product->product_id) }}"
title="{{ __('velocity::app.shop.wishlist.add-wishlist-text') }}"
@elseif (isset($itemId) && $itemId)
href="{{ route('customer.wishlist.remove', $itemId) }}"
title="{{ __('velocity::app.shop.wishlist.remove-wishlist-text') }}"
@endif>
href="{{ $href }}"
title="{{ $title }}">
<wishlist-component active="{{ ! $isWished }}"></wishlist-component>
<wishlist-component active="{{ $wishlist ? false : true }}"></wishlist-component>
@if (isset($text))
{!! $text !!}