laravel-wishlist icon indicating copy to clipboard operation
laravel-wishlist copied to clipboard

Undefined variable: lists when wishlist is empty

Open Omar-Abdelrady opened this issue 4 years ago • 6 comments

image

Omar-Abdelrady avatar Dec 05 '20 22:12 Omar-Abdelrady

I just tagged a new release with an additional check in the wishlistResponse method. https://github.com/lamalamaNL/laravel-wishlist/releases/tag/0.2.1

To be sure, can you share your full ErrorExpception via the Share button?

lamalamaMark avatar Dec 06 '20 08:12 lamalamaMark

https://flareapp.io/share/dmkzxe65#F59

Omar-Abdelrady avatar Dec 06 '20 08:12 Omar-Abdelrady

What is your opinion ?

Omar-Abdelrady avatar Dec 06 '20 10:12 Omar-Abdelrady

https://flareapp.io/share/KPgneWem#F52 how to fix this, this same issue

madmouse17 avatar May 07 '21 15:05 madmouse17

Hello, the lib still has an issue at this level, a $items->isEmpty() is missing in the if condition of the method wishlistResponse

cephee avatar Sep 06 '21 15:09 cephee

Hey guys, You can fix that issue with this code (in the blade): <?php $continue = 0; try { $has = Auth::user()->wishlists("default")["default"][0]->contains($product->id); $continue = 1; } catch (\Throwable $th) { $continue = 0; } ?> Then you can continue the blade code with: @if ($continue == 1) YOUR_CODE @endif

I hope I helped.

ricsirobi avatar Nov 21 '22 11:11 ricsirobi