lamalamaNL / laravel-wishlist

Wishlist for Laravel
https://lamalama.nl
MIT License
22 stars 5 forks source link

Undefined variable: lists when wishlist is empty #8

Open Omar-Abdelrady opened 3 years ago

Omar-Abdelrady commented 3 years ago

image

lamalamaMark commented 3 years ago

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?

Omar-Abdelrady commented 3 years ago

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

Omar-Abdelrady commented 3 years ago

What is your opinion ?

madmouse17 commented 3 years ago

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

cephee commented 3 years ago

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

ricsirobi commented 1 year ago

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.