<?php
//Obfuscated by YAK Pro - Php Obfuscator 2.0.13 at 2025-05-27 11:02:05
 namespace App\Http\Controllers; use App\DeliveryAddress; use App\Product; use Illuminate\Http\Request; use Illuminate\Support\Arr; use App\Http\Resources\UserWishlistResource; use App\UserWishlist; use Validator; class WishlistController extends Controller { const ITEM_PER_PAGE = 20; private $_user; public function __construct() { $this->_user = auth("\141\160\151")->user(); } public function index(Request $request) { goto CXb0H; g14Qf: $cTzdr = UserWishlist::where("\165\163\x65\x72\x5f\151\144", $this->_user->id); if (empty($yl8cG)) { goto F8IcA; } $cTzdr->where("\x70\x72\157\144\x75\143\x74\x5f\x69\144", "\x4c\111\x4b\105", "\45" . $yl8cG . "\45"); goto hV920; CXb0H: $Ix00U = $request->all(); $HW7WX = Arr::get($Ix00U, "\x6c\x69\155\151\164", static::ITEM_PER_PAGE); $yl8cG = Arr::get($Ix00U, "\153\145\x79\167\x6f\x72\144", ''); goto g14Qf; hV920: F8IcA: $cTzdr->orderBy("\143\x72\x65\141\x74\145\144\x5f\141\x74"); return UserWishlistResource::collection($cTzdr->paginate($HW7WX)); goto ppwCr; ppwCr: } public function store(Request $request) { goto Q1ztO; xsdYc: XLkmX: $params = $request->all(); $E4aAa = Product::isPublished()->where("\x69\x64", $params["\160\x72\157\144\165\x63\164\137\151\x64"])->first(); goto pc7tl; Q1ztO: $nzr3U = Validator::make($request->all(), ["\160\x72\157\144\x75\143\x74\x5f\151\x64" => ["\x72\145\161\x75\x69\x72\x65\x64"]]); if (!$nzr3U->fails()) { goto XLkmX; } return response()->json(["\x65\x72\x72\x6f\162\163" => $nzr3U->errors()], 403); goto xsdYc; pc7tl: if ($E4aAa) { goto USJ03; } response()->json(["\x65\162\x72\x6f\162" => "\350\243\xbd\xe5\x93\x81\xe3\x81\214\345\255\x98\xe5\x9c\xa8\343\x81\x97\343\x81\276\xe3\201\233\xe3\202\x93\343\x80\x82"], 403); USJ03: goto sY8TR; sY8TR: $rMjA6 = UserWishlist::where("\x75\163\145\x72\x5f\151\144", $this->_user->id)->where("\x70\162\x6f\x64\x75\x63\164\137\151\x64", $E4aAa->id)->count(); if (!($rMjA6 > 0)) { goto s0XUe; } return response()->json(["\163\164\x61\x74\x75\x73" => "\x65\x78\x69\x73\164"], 200); goto kXNcd; kXNcd: s0XUe: UserWishlist::create(["\x75\x73\x65\162\137\x69\144" => $this->_user->id, "\x70\162\x6f\144\x75\x63\164\x5f\x69\144" => $E4aAa->id, "\x63\162\x65\141\164\145\144\x5f\141\x74" => date("\131\x2d\x6d\x2d\x64\x20\110\x3a\151\72\163"), "\x75\x70\144\x61\164\145\144\x5f\141\164" => date("\x59\x2d\155\x2d\144\40\110\72\151\72\x73")]); $l1i71 = $E4aAa->wish_list + 1; goto LNv_W; LNv_W: $E4aAa->update(["\167\151\x73\x68\x5f\x6c\x69\x73\x74" => $l1i71]); return response()->json(["\x73\x74\x61\x74\165\x73" => "\163\165\x63\143\x65\163\163"], 200); goto PQR11; PQR11: } public function check($p76s1 = 0) { goto Onzv3; me2C9: if (!($rMjA6 > 0)) { goto JJKIh; } return response()->json(["\x73\x74\x61\x74\165\x73" => "\x73\x75\143\143\x65\x73\x73"], 200); JJKIh: goto U_3Qg; U_3Qg: ahKDO: return response()->json(["\x73\x74\x61\x74\165\x73" => "\146\141\151\x6c"], 200); goto HhWDf; Onzv3: $E4aAa = Product::isPublished()->where("\x69\x64", $p76s1)->first(); if (!$E4aAa) { goto ahKDO; } $rMjA6 = UserWishlist::where("\x75\x73\x65\162\x5f\x69\144", $this->_user->id)->where("\x70\x72\x6f\x64\165\143\164\x5f\151\x64", $E4aAa->id)->count(); goto me2C9; HhWDf: } public function destroy($p76s1 = 0) { $R6FtO = UserWishlist::where("\165\x73\x65\162\x5f\x69\x64", $this->_user->id)->where("\x69\x64", $p76s1)->first(); if ($R6FtO) { goto lZQPT; } response()->json(["\145\x72\162\x6f\162" => "\x43\141\156\x20\156\x6f\x74\x20\144\x65\x6c\x65\164\145\x20\164\x68\x69\163\x20\x69\x74\145\155\56"], 403); lZQPT: try { $R6FtO->delete(); } catch (\Exception $u5BpI) { response()->json(["\x65\162\x72\157\x72" => $u5BpI->getMessage()], 403); } return response()->json(null, 204); } public function destroyProductFromWishlist($p76s1 = 0) { try { goto EN6jZ; Gb9b2: aQe_w: goto DkkdS; gcRk0: if (!$yttFR) { goto fwaSC; } $yttFR->delete(); fwaSC: goto Gb9b2; EN6jZ: $E4aAa = Product::isPublished()->where("\151\144", $p76s1)->first(); if (!$E4aAa) { goto aQe_w; } $yttFR = UserWishlist::where("\165\163\x65\x72\x5f\151\144", $this->_user->id)->where("\x70\162\157\144\165\143\x74\x5f\151\x64", $E4aAa->id)->first(); goto gcRk0; DkkdS: } catch (\Exception $u5BpI) { response()->json(["\145\x72\162\x6f\x72" => $u5BpI->getMessage()], 403); } return response()->json(null, 204); } }