<?php
//Obfuscated by YAK Pro - Php Obfuscator 2.0.13 at 2025-05-27 11:01:52
 namespace App\Http\Controllers\Admin; use App\CategoryDetail; use App\CategoryManufacturer; use App\Helpers\Helper; use App\Http\Controllers\Controller; use Illuminate\Http\Request; use Illuminate\Support\Arr; use App\Category; use App\Http\Resources\Admin\CategoryResource; use Validator; class CategoryController extends Controller { const ITEM_PER_PAGE = 100; public function index(Request $request) { goto aqGQB; aqGQB: $kX7tA = $request->all(); $cH0FE = Category::notDeleted(); $c0TT5 = Arr::get($kX7tA, "\154\x69\x6d\151\164", static::ITEM_PER_PAGE); goto Sl1QY; Sl1QY: $fX23X = Arr::get($kX7tA, "\x6b\x65\x79\167\157\162\144", ''); $oBey4 = Arr::get($kX7tA, "\x73\164\x61\x74\x75\x73", ''); $O5zXT = Arr::get($kX7tA, "\x69\163\x54\x6f\x70", ''); goto y824n; fMRCy: $cH0FE->orderBy("\160\x6f\163\151\164\x69\x6f\x6e")->orderBy("\151\144"); return CategoryResource::collection($cH0FE->paginate($c0TT5)); goto AH7Na; yEs1p: if (!($oBey4 != '')) { goto kM3HB; } $cH0FE->where("\151\x73\137\141\x63\164\151\166\x61\164\x65\x64", $oBey4); kM3HB: goto kFj7S; kFj7S: if (!($O5zXT != '')) { goto PrFLo; } $cH0FE->where("\x69\x73\137\164\157\x70", $O5zXT); PrFLo: goto fMRCy; y824n: if (empty($fX23X)) { goto utwBR; } $cH0FE->where("\x6e\141\x6d\145", "\x4c\x49\x4b\105", "\45" . $fX23X . "\45"); utwBR: goto yEs1p; AH7Na: } public function all(Request $request) { $kX7tA = $request->all(); $c0TT5 = Arr::get($kX7tA, "\154\x69\x6d\151\164", static::ITEM_PER_PAGE); $cH0FE = Category::select("\x69\x64", "\156\x61\x6d\x65", "\x73\154\x75\x67")->notDeleted()->orderBy("\x70\x6f\163\x69\x74\151\x6f\x6e")->orderBy("\x69\144"); return CategoryResource::collection($cH0FE->paginate($c0TT5)); } public function allNested(Request $request) { goto cDhqZ; hjx_T: $cH0FE = $cH0FE->where("\x69\x64", "\x21\x3d", $Hf3iJ); Hu3Kz: $cH0FE = $cH0FE->orderBy("\x70\157\x73\x69\x74\151\157\x6e")->orderBy("\x69\144")->get(); goto dUyVh; dUyVh: $QGNRM = $this->getChildItems($cH0FE, 0); return response()->json(["\144\141\x74\x61" => $QGNRM], 200); goto PVZ9E; cDhqZ: $Hf3iJ = Arr::get($request->all(), "\151\147\156\157\162\x65\x49\x64", ''); $cH0FE = Category::select("\x2a")->isPublished(); if (!($Hf3iJ != null && $Hf3iJ != '')) { goto Hu3Kz; } goto hjx_T; PVZ9E: } public function getChildItems($cH0FE, $V_WjJ = 0) { $QGNRM = []; foreach ($cH0FE as $F4OuD) { goto azVMF; ctKKF: $QGNRM[] = $NZkUB; wjp0U: fTwNs: goto j0Cqv; owTAQ: if (!($pd8au !== null && count($pd8au) > 0)) { goto I096l; } $NZkUB["\143\150\x69\154\x64\x72\145\x6e"] = $pd8au; I096l: goto ctKKF; azVMF: if (!($F4OuD->parent_id == $V_WjJ)) { goto wjp0U; } $NZkUB = ["\x76\141\154\165\145" => $F4OuD->id, "\x6c\141\x62\x65\154" => $F4OuD->name]; $pd8au = $this->getChildItems($cH0FE, $F4OuD->id); goto owTAQ; j0Cqv: } Ej03K: return $QGNRM; } public function available(Request $request) { goto B5XKB; rGM0p: return CategoryResource::collection($cH0FE->get()); goto iZcgc; RojXO: $cH0FE->where("\x69\x64", "\41\x3d", $Hf3iJ); JGneB: $cH0FE->orderBy("\160\x6f\x73\x69\164\x69\157\156")->orderBy("\151\144"); goto rGM0p; B5XKB: $Hf3iJ = Arr::get($request->all(), "\151\147\x6e\x6f\x72\145\x49\144", ''); $cH0FE = Category::select("\x69\x64", "\156\x61\x6d\145")->isPublished(); if (!($Hf3iJ != null && $Hf3iJ != '')) { goto JGneB; } goto RojXO; iZcgc: } public function show($kPxg8 = 0) { $gs20c = Category::notDeleted()->where("\x69\x64", $kPxg8)->first(); if (isset($gs20c)) { goto ZwrU0; } return response()->json(["\145\x72\162\x6f\x72\x73" => "\x43\x61\164\145\147\x6f\x72\x79\x20\151\163\40\x6e\157\x74\x20\x76\x61\x6c\x69\x64"], 403); ZwrU0: return new CategoryResource($gs20c); } public function store(Request $request) { goto A6F8M; lWAwe: AYrNB: I0LN2: return new CategoryResource($gs20c); goto zA2PR; A6F8M: $mabWw = Validator::make($request->all(), ["\156\141\155\145" => ["\x72\x65\x71\165\x69\x72\x65\x64"], "\x69\163\137\141\x63\164\151\166\x61\x74\x65\x64" => ["\162\x65\x71\x75\x69\162\145\x64"]]); if (!$mabWw->fails()) { goto WFSET; } return response()->json(["\x65\162\162\x6f\162\x73" => $mabWw->errors()], 403); goto Nt7w_; YWjqj: if (!($ymJLY == null || $ymJLY == '')) { goto uyPMf; } $ymJLY = Helper::slug($params["\x6e\x61\x6d\x65"]); uyPMf: goto K3C7W; Oee4W: $R0doh++; A1Sod: $IkkRc = 0; goto R8K6F; R8K6F: if (!(is_array($params["\x70\141\162\145\x6e\164\137\151\x64"]) && isset($params["\x70\141\162\x65\156\164\x5f\x69\x64"][array_key_last($params["\x70\x61\x72\145\156\x74\x5f\x69\x64"])]))) { goto DIdb1; } $IkkRc = $params["\x70\141\x72\145\x6e\164\137\151\x64"][array_key_last($params["\160\141\x72\145\x6e\x74\x5f\151\144"])]; DIdb1: goto g5qoj; K3C7W: $qnSVF = Category::where("\151\163\x5f\x64\x65\x6c\x65\164\x65\x64", false)->orderBy("\160\x6f\x73\151\x74\151\x6f\156", "\x64\145\x73\x63")->first(); $R0doh = isset($qnSVF) ? $qnSVF->position : 0; if (!($R0doh > 0)) { goto A1Sod; } goto Oee4W; Nt7w_: WFSET: $params = $request->all(); $ymJLY = $params["\163\154\x75\x67"]; goto YWjqj; g5qoj: $gs20c = Category::create(["\x6e\x61\155\145" => $params["\x6e\x61\x6d\x65"], "\x73\154\165\x67" => Helper::slug($ymJLY), "\x70\x61\x72\x65\156\164\x5f\151\144" => $IkkRc, "\151\155\141\147\145" => $params["\x69\x6d\x61\x67\x65"], "\163\165\x62\x5f\x74\x69\x74\154\145" => $params["\163\165\x62\137\164\x69\164\x6c\145"], "\x67\162\157\165\x70" => $params["\x67\162\x6f\x75\160"], "\144\x65\163\143\x72\x69\160\164\151\157\x6e" => $params["\144\x65\163\x63\x72\151\160\164\151\x6f\x6e"], "\x72\141\156\x6b" => $params["\162\141\156\x6b"] != null && $params["\x72\141\x6e\153"] != '' ? $params["\x72\141\156\x6b"] : null, "\x70\157\x73\x69\x74\151\157\156" => $R0doh, "\151\x73\x5f\164\157\160" => $params["\151\x73\137\x74\157\x70"] === true ? 1 : 0, "\151\163\x5f\x61\143\164\x69\166\141\x74\x65\144" => $params["\x69\163\137\x61\143\x74\x69\x76\141\164\x65\x64"] === true ? 1 : 0, "\x63\162\145\141\x74\145\x64\137\141\164" => date("\x59\55\x6d\55\144\x20\110\x3a\x69\72\163"), "\x75\x70\144\141\x74\x65\x64\137\x61\x74" => date("\131\55\x6d\55\144\40\x48\x3a\151\72\163")]); if (!isset($params["\155\141\156\165\146\141\143\x74\x75\162\145\162"])) { goto I0LN2; } foreach ($params["\x6d\x61\156\x75\146\141\143\x74\165\x72\x65\x72"] as $F4OuD) { if (!(!isset($F4OuD[0]) || $F4OuD[0] == null || $F4OuD[0] == '')) { goto Nx3y6; } goto xfr6A; Nx3y6: CategoryManufacturer::create(["\143\x61\x74\x65\147\x6f\x72\171\137\151\144" => $gs20c->id, "\155\x61\156\165\x66\x61\143\164\x75\x72\145\x72\137\x69\144" => $F4OuD[0]["\x69\144"], "\143\x72\x65\x61\164\x65\x64\137\141\x74" => date("\131\x2d\155\55\144\x20\110\72\151\72\163"), "\x75\x70\x64\x61\x74\x65\x64\137\141\x74" => date("\131\x2d\x6d\x2d\144\40\x48\72\x69\x3a\x73")]); xfr6A: } goto lWAwe; zA2PR: } public function update(Request $request, $kPxg8 = 0) { goto ecSvP; rAcUh: if (!isset($params["\155\x61\156\165\x66\x61\x63\x74\x75\162\x65\162"])) { goto fDzuz; } CategoryManufacturer::where("\143\141\x74\145\x67\x6f\x72\171\x5f\x69\144", $gs20c->id)->delete(); foreach ($params["\x6d\x61\156\165\x66\141\143\x74\x75\x72\145\162"] as $F4OuD) { if (!(!isset($F4OuD[0]) || $F4OuD[0] == null || $F4OuD[0] == '')) { goto PW5fC; } goto dXCRv; PW5fC: CategoryManufacturer::create(["\143\x61\x74\x65\147\x6f\162\171\137\151\x64" => $gs20c->id, "\155\141\x6e\x75\x66\141\x63\x74\x75\x72\x65\162\x5f\151\x64" => $F4OuD[0]["\151\x64"], "\143\162\x65\x61\x74\x65\x64\x5f\x61\x74" => date("\131\55\x6d\55\144\x20\110\72\x69\72\163"), "\165\x70\144\141\x74\145\x64\137\141\x74" => date("\131\x2d\x6d\x2d\144\x20\x48\x3a\151\72\163")]); dXCRv: } goto F0n1p; xN2Ij: $ymJLY = $params["\163\154\x75\x67"]; if (!($ymJLY == null || $ymJLY == '')) { goto EIPbT; } $ymJLY = Helper::slug($params["\x6e\x61\155\145"]); goto INxfc; kQBpM: $IkkRc = $params["\160\141\162\x65\x6e\164\137\151\144"][array_key_last($params["\160\141\x72\145\156\x74\x5f\x69\144"])]; g0HFW: $gs20c->update(["\156\141\155\x65" => $params["\156\141\x6d\x65"], "\163\154\165\x67" => Helper::slug($ymJLY), "\160\141\x72\145\156\164\137\x69\x64" => $IkkRc, "\x69\155\x61\147\x65" => $params["\x69\155\x61\147\145"], "\163\x75\142\137\x74\151\x74\x6c\x65" => $params["\163\x75\142\137\x74\151\x74\154\x65"], "\x67\x72\x6f\x75\x70" => $params["\147\162\x6f\165\x70"], "\x64\x65\163\143\x72\151\160\x74\151\x6f\156" => $params["\144\145\x73\x63\x72\x69\x70\x74\x69\157\156"], "\x72\141\x6e\153" => $params["\x72\141\x6e\153"] != null && $params["\x72\x61\156\153"] != '' ? $params["\x72\x61\156\x6b"] : null, "\151\163\137\x74\157\x70" => $params["\151\x73\137\x74\157\x70"] === true ? 1 : 0, "\x69\163\x5f\x61\143\164\x69\166\x61\164\145\144" => $params["\151\x73\137\141\143\x74\x69\166\x61\x74\x65\144"] === true ? 1 : 0, "\165\160\x64\x61\164\145\x64\x5f\141\x74" => date("\131\55\155\55\144\x20\x48\x3a\x69\x3a\x73")]); goto rAcUh; VwZCq: j9GY7: $gs20c = Category::notDeleted()->where("\151\x64", $kPxg8)->first(); if (isset($gs20c)) { goto NoTtG; } goto FfRyg; FfRyg: return response()->json(["\x65\x72\x72\x6f\162\163" => "\x43\141\164\145\x67\x6f\162\x79\x20\151\x73\40\x6e\x6f\164\40\x76\x61\x6c\x69\x64"], 403); NoTtG: $params = $request->all(); goto xN2Ij; INxfc: EIPbT: $IkkRc = 0; if (!(is_array($params["\160\141\x72\x65\x6e\164\x5f\151\x64"]) && isset($params["\160\x61\162\x65\156\164\137\151\x64"][array_key_last($params["\160\141\162\145\156\x74\x5f\x69\144"])]))) { goto g0HFW; } goto kQBpM; ecSvP: $mabWw = Validator::make($request->all(), ["\156\x61\155\x65" => ["\x72\x65\161\165\151\162\145\144"], "\151\163\137\141\143\x74\x69\166\141\x74\145\x64" => ["\162\145\x71\x75\x69\x72\145\x64"]]); if (!$mabWw->fails()) { goto j9GY7; } return response()->json(["\145\x72\x72\x6f\162\163" => $mabWw->errors()], 403); goto VwZCq; F0n1p: K9myP: fDzuz: return response()->json(null, 204); goto PB2WY; PB2WY: } public function destroy($kPxg8 = 0) { $gs20c = Category::notDeleted()->where("\151\144", $kPxg8)->first(); if (isset($gs20c)) { goto cGepK; } response()->json(["\x65\162\x72\157\x72" => "\x45\x68\150\x68\x21\40\103\x61\x6e\40\x6e\157\x74\40\x64\145\x6c\x65\164\x65\40\164\x68\x69\x73\40\143\141\x74\x65\x67\x6f\162\x79"], 403); cGepK: try { $gs20c->update(["\x69\163\137\x64\x65\154\145\x74\x65\x64" => true]); } catch (\Exception $yNQhJ) { response()->json(["\x65\162\162\157\162" => $yNQhJ->getMessage()], 403); } return response()->json(null, 204); } public function destroyMultiple(Request $request) { goto R1FP1; vj7U0: if (!($tfhHS->count() <= 0)) { goto GiGK7; } response()->json(["\145\162\162\x6f\162" => "\103\x61\x74\x65\x67\157\162\x79\40\151\x73\40\156\157\164\40\x76\141\x6c\151\x64\x2e"], 403); GiGK7: goto pq1y3; CatXb: xPPuY: $rokOo = $request->get("\151\x64\163", []); $tfhHS = Category::notDeleted()->whereIn("\x69\144", $rokOo)->get(); goto vj7U0; R1FP1: $mabWw = Validator::make($request->all(), ["\x69\144\163" => "\162\x65\161\x75\x69\x72\x65\144"]); if (!$mabWw->fails()) { goto xPPuY; } return response()->json(["\145\x72\x72\157\x72\x73" => $mabWw->errors()], 403); goto CatXb; pq1y3: try { Category::notDeleted()->whereIn("\x69\144", $rokOo)->update(["\x69\163\x5f\x64\145\154\145\x74\145\x64" => true]); } catch (\Exception $yNQhJ) { response()->json(["\145\x72\x72\x6f\162" => $yNQhJ->getMessage()], 403); } return response()->json(null, 204); goto uCr1B; uCr1B: } public function activateMultiple(Request $request) { goto BgQlu; BFJ2R: b1vcY: $rokOo = $request->get("\151\x64\x73", []); $tfhHS = Category::notDeleted()->whereIn("\151\144", $rokOo)->get(); goto v7w8i; v7w8i: if (!($tfhHS->count() <= 0)) { goto xaPRR; } response()->json(["\x65\162\162\x6f\162" => "\103\141\x74\x65\x67\157\162\x79\x20\151\x73\x20\x6e\157\x74\40\x76\141\x6c\x69\144\x2e"], 403); xaPRR: goto qEEcL; qEEcL: try { Category::notDeleted()->whereIn("\151\x64", $rokOo)->update(["\x69\x73\137\141\143\164\151\x76\141\164\x65\x64" => true]); } catch (\Exception $yNQhJ) { response()->json(["\145\x72\162\157\162" => $yNQhJ->getMessage()], 403); } return response()->json(null, 204); goto eXkLU; BgQlu: $mabWw = Validator::make($request->all(), ["\151\x64\163" => "\162\145\x71\165\x69\162\x65\144"]); if (!$mabWw->fails()) { goto b1vcY; } return response()->json(["\145\162\x72\157\x72\163" => $mabWw->errors()], 403); goto BFJ2R; eXkLU: } public function deactivateMultiple(Request $request) { goto JS4Pw; LsgRl: try { Category::notDeleted()->whereIn("\151\x64", $rokOo)->update(["\x69\163\x5f\141\x63\164\x69\166\141\x74\x65\144" => false]); } catch (\Exception $yNQhJ) { response()->json(["\x65\162\x72\157\x72" => $yNQhJ->getMessage()], 403); } return response()->json(null, 204); goto cZabi; nM5kQ: Fp3ZV: $rokOo = $request->get("\151\x64\163", []); $tfhHS = Category::notDeleted()->whereIn("\151\x64", $rokOo)->get(); goto xRvxs; xRvxs: if (!($tfhHS->count() <= 0)) { goto M31wj; } response()->json(["\145\162\x72\157\x72" => "\x43\x61\164\x65\147\157\x72\x79\40\151\163\x20\156\x6f\x74\40\x76\x61\154\151\x64\56"], 403); M31wj: goto LsgRl; JS4Pw: $mabWw = Validator::make($request->all(), ["\x69\x64\x73" => "\x72\x65\x71\165\151\162\145\144"]); if (!$mabWw->fails()) { goto Fp3ZV; } return response()->json(["\145\x72\162\x6f\x72\163" => $mabWw->errors()], 403); goto nM5kQ; cZabi: } public function position(Request $request) { goto P3ByC; P3ByC: if ($request->has("\x70\157\x73\x69\x74\151\x6f\156")) { goto p0Sxp; } return response()->json(["\145\x72\x72\x6f\x72\163" => "\104\141\x74\141\40\x69\163\x20\151\x6e\x76\141\154\151\x64"], 403); p0Sxp: goto aQVzb; VaEly: EKEN1: luZvz: return response()->json(null, 204); goto DFBOC; aQVzb: $JH12P = $request->position; if (!is_array($JH12P)) { goto luZvz; } foreach ($JH12P as $F4OuD) { Category::where("\151\144", $F4OuD["\151\144"])->update(["\160\x6f\163\x69\x74\x69\157\156" => $F4OuD["\x6f\162\x64\x65\162"]]); Aiw3K: } goto VaEly; DFBOC: } public function setTop($kPxg8 = 0) { goto gms0n; gms0n: $gs20c = Category::notDeleted()->where("\x69\x64", $kPxg8)->first(); if (isset($gs20c)) { goto hjies; } response()->json(["\x65\x72\x72\157\x72" => "\x45\150\x68\150\x21\x20\103\x61\156\x20\156\x6f\x74\x20\x73\x65\164\40\164\157\160\40\x74\150\151\163\40\x63\141\x74\x65\x67\x6f\162\x79"], 403); goto Rtbvz; H3bDs: return response()->json(null, 204); goto t7cmG; Rtbvz: hjies: $O5zXT = $gs20c->is_top == 0; $gs20c->update(["\151\163\137\164\157\160" => $O5zXT]); goto H3bDs; t7cmG: } }