@prashant-webkul * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ class WishlistController extends Controller { protected $customer; public function __construct() { if(auth()->guard('customer')->check()) { $this->customer = auth()->guard('customer')->user(); } else { return response()->json('Unauthorized', 401); } } public function getWishlist() { $wishlist = $this->customer->wishlist_items; if($wishlist->count() > 0) { return response()->json($wishlist, 200); } else { return response()->json('Wishlist Empty', 200); } } }