<?php
//Obfuscated by YAK Pro - Php Obfuscator 2.0.13 at 2025-05-27 11:01:55
 namespace App\Http\Controllers\Admin; use App\Category; use App\CategoryManufacturer; use App\Helpers\Helper; use App\Http\Controllers\Controller; use Illuminate\Http\Request; use Illuminate\Support\Arr; use App\Manufacturer; use App\Http\Resources\Admin\ManufacturerResource; use Validator; class ManufacturerController extends Controller { const ITEM_PER_PAGE = 100; public function index(Request $request) { goto NDKsq; NDKsq: $LgpTU = $request->all(); $Rgm84 = Manufacturer::notDeleted(); $k6zwC = Arr::get($LgpTU, "\x6c\151\155\x69\164", static::ITEM_PER_PAGE); goto lOMae; Y8351: if (empty($Dw21W)) { goto tROrh; } $Rgm84->where("\x6e\141\155\x65", "\x4c\111\x4b\105", "\45" . $Dw21W . "\x25"); tROrh: goto HRV3O; tJkHw: $JjYky = Category::select("\151\144", "\160\141\162\145\156\164\137\x69\x64")->where("\151\144", "\41\75", $z_LpU)->whereNotNull("\160\x61\162\145\156\164\137\x69\144")->get(); $p38SA = $this->detectParentCategoryId($JjYky, $Cbg1Q->parent_id); $p38SA[] = $Cbg1Q->id; goto TYrrT; TYrrT: $UKWru = CategoryManufacturer::whereIn("\x63\x61\x74\x65\x67\x6f\x72\171\137\x69\x64", $p38SA)->pluck("\155\141\x6e\165\x66\141\143\x74\165\x72\x65\162\x5f\x69\x64")->toArray(); $Rgm84->whereIn("\x69\x64", $UKWru); FP7ux: goto ez6D9; HRV3O: if (empty($z_LpU)) { goto NhIGB; } $Cbg1Q = Category::where("\151\x64", $z_LpU)->first(); if (!isset($Cbg1Q)) { goto FP7ux; } goto tJkHw; lOMae: $Dw21W = Arr::get($LgpTU, "\153\x65\x79\x77\157\x72\x64", ''); $XclK6 = Arr::get($LgpTU, "\x73\x74\141\164\x75\163", ''); $z_LpU = Arr::get($LgpTU, "\x63\x61\164\145\x67\x6f\x72\x79\111\144", ''); goto Y8351; dNqkR: GAQ9L: $Rgm84->orderBy("\x70\x6f\163\x69\x74\151\x6f\x6e")->orderBy("\x69\144"); return ManufacturerResource::collection($Rgm84->paginate($k6zwC)); goto u_dSD; ez6D9: NhIGB: if (!($XclK6 != '')) { goto GAQ9L; } $Rgm84->where("\x69\x73\137\141\x63\164\151\166\x61\x74\145\144", $XclK6); goto dNqkR; u_dSD: } public function all(Request $request) { $LgpTU = $request->all(); $k6zwC = Arr::get($LgpTU, "\x6c\x69\155\x69\x74", static::ITEM_PER_PAGE); $Rgm84 = Manufacturer::select("\151\x64", "\156\141\155\x65", "\x73\154\x75\147")->notDeleted()->orderBy("\160\157\163\x69\164\151\x6f\156")->orderBy("\151\x64"); return ManufacturerResource::collection($Rgm84->paginate($k6zwC)); } public function allNested() { $Rgm84 = Manufacturer::select("\x2a")->notDeleted()->orderBy("\160\x6f\x73\x69\164\x69\157\x6e")->get(); $rQlnA = $this->getChildItems($Rgm84, 0); return response()->json(["\144\141\x74\x61" => $rQlnA], 200); } public function getChildItems($Rgm84, $Jv8UI = 0) { $rQlnA = []; foreach ($Rgm84 as $bD3_i) { goto cQpZm; u5_UK: if (!($x3BVh !== null && count($x3BVh) > 0)) { goto iFrEd; } $U4UgJ["\143\x68\x69\x6c\x64\x72\x65\x6e"] = $x3BVh; iFrEd: goto E43tr; E43tr: $rQlnA[] = $U4UgJ; NinOZ: cl2bu: goto AgpBY; cQpZm: if (!($bD3_i->parent_id == $Jv8UI)) { goto NinOZ; } $U4UgJ = ["\x76\141\154\165\x65" => $bD3_i->id, "\154\x61\x62\x65\x6c" => $bD3_i->name]; $x3BVh = $this->getChildItems($Rgm84, $bD3_i->id); goto u5_UK; AgpBY: } sa3hf: return $rQlnA; } public function available() { $Rgm84 = Manufacturer::select("\151\144", "\x6e\141\x6d\145")->notDeleted()->activated()->orderBy("\x70\x6f\x73\x69\x74\151\157\x6e")->orderBy("\151\144"); return ManufacturerResource::collection($Rgm84->get()); } public function show($SQYSk = 0) { $yOq5R = Manufacturer::notDeleted()->where("\151\x64", $SQYSk)->first(); if (isset($yOq5R)) { goto naqWq; } return response()->json(["\x65\x72\162\x6f\x72\163" => "\103\x61\164\145\x67\157\162\171\x20\151\163\x20\156\157\x74\x20\166\x61\x6c\151\144"], 403); naqWq: return new ManufacturerResource($yOq5R); } public function store(Request $request) { goto xBSWb; UxHVO: PlTQZ: $params = $request->all(); $jswur = $params["\163\154\165\147"]; goto Ed6lS; yjqdD: return new ManufacturerResource($yOq5R); goto zwTeX; Ed6lS: if (!($jswur == null || $jswur == '')) { goto Hm1u_; } $jswur = Helper::slug($params["\156\x61\x6d\x65"]); Hm1u_: goto kJ1pf; xBSWb: $U09iK = Validator::make($request->all(), ["\156\141\x6d\145" => ["\x72\145\x71\165\151\x72\145\x64"], "\x69\163\x5f\x61\143\x74\151\x76\141\164\x65\144" => ["\x72\x65\161\165\151\x72\145\x64"]]); if (!$U09iK->fails()) { goto PlTQZ; } return response()->json(["\145\x72\x72\x6f\162\163" => $U09iK->errors()], 403); goto UxHVO; kJ1pf: $gvrRP = Manufacturer::where("\151\x73\137\x64\x65\154\x65\164\145\x64", false)->orderBy("\160\x6f\163\151\164\151\157\156", "\x64\x65\x73\x63")->first(); $eReHi = isset($gvrRP) ? $gvrRP->position : 0; if (!($eReHi > 0)) { goto yvUBT; } goto jIagM; jIagM: $eReHi++; yvUBT: $yOq5R = Manufacturer::create(["\x6e\x61\155\x65" => $params["\x6e\141\x6d\x65"], "\163\x6c\x75\x67" => Helper::slug($jswur), "\x70\x61\162\x65\156\x74\137\x69\144" => $params["\x70\141\x72\x65\x6e\164\x5f\151\144"], "\x69\x6d\x61\147\x65" => $params["\151\155\x61\x67\145"], "\x64\x65\163\x63\162\x69\x70\x74\151\157\156" => $params["\x64\145\x73\x63\x72\x69\160\164\151\x6f\x6e"], "\162\141\156\x6b" => $params["\162\141\156\153"] != null && $params["\162\141\156\153"] != '' ? $params["\x72\x61\x6e\x6b"] : null, "\160\x6f\163\x69\x74\151\x6f\156" => $eReHi, "\x69\x73\x5f\x61\x63\164\151\x76\x61\164\x65\144" => $params["\151\x73\137\x61\x63\164\151\x76\141\x74\x65\x64"] === true ? 1 : 0, "\143\x72\145\x61\x74\x65\x64\137\141\164" => date("\x59\55\x6d\x2d\x64\x20\x48\72\151\x3a\x73"), "\x75\160\144\x61\164\145\x64\x5f\x61\x74" => date("\x59\x2d\155\55\144\x20\x48\x3a\x69\72\163")]); goto yjqdD; zwTeX: } public function update(Request $request, $SQYSk = 0) { goto Y2Iso; G4Iha: Va1DY: $yOq5R->update(["\x6e\141\155\x65" => $params["\x6e\141\155\145"], "\163\154\165\147" => Helper::slug($jswur), "\160\141\162\x65\x6e\164\137\151\144" => $params["\160\x61\162\145\156\x74\137\x69\144"], "\144\145\163\x63\x72\x69\x70\164\x69\x6f\x6e" => $params["\x64\x65\163\143\162\x69\x70\x74\x69\x6f\x6e"], "\162\x61\156\153" => $params["\162\x61\156\x6b"] != null && $params["\x72\x61\156\x6b"] != '' ? $params["\162\141\x6e\x6b"] : null, "\x69\163\137\x61\143\164\151\x76\141\x74\x65\144" => $params["\x69\163\137\x61\143\x74\x69\166\141\164\x65\144"] === true ? 1 : 0, "\165\x70\x64\141\x74\145\144\x5f\x61\x74" => date("\131\55\155\55\x64\40\110\x3a\151\x3a\163")]); return response()->json(null, 204); goto E0Ife; At6Hu: Gu85G: $yOq5R = Manufacturer::notDeleted()->where("\151\144", $SQYSk)->first(); if (isset($yOq5R)) { goto LozPM; } goto mTX7D; Y2Iso: $U09iK = Validator::make($request->all(), ["\156\x61\x6d\x65" => ["\x72\x65\161\x75\151\162\x65\144"], "\151\x73\x5f\141\x63\x74\151\x76\141\164\x65\144" => ["\x72\145\161\x75\x69\x72\145\x64"]]); if (!$U09iK->fails()) { goto Gu85G; } return response()->json(["\x65\x72\x72\x6f\162\163" => $U09iK->errors()], 403); goto At6Hu; mJFfm: $jswur = $params["\x73\x6c\165\x67"]; if (!($jswur == null || $jswur == '')) { goto Va1DY; } $jswur = Helper::slug($params["\156\141\155\145"]); goto G4Iha; mTX7D: return response()->json(["\x65\162\162\x6f\x72\x73" => "\115\141\156\165\146\x61\143\164\x75\x72\x65\162\x20\x69\163\40\156\x6f\x74\x20\x76\x61\154\151\x64"], 403); LozPM: $params = $request->all(); goto mJFfm; E0Ife: } public function destroy($SQYSk = 0) { $yOq5R = Manufacturer::notDeleted()->where("\x69\x64", $SQYSk)->first(); if (isset($yOq5R)) { goto In1ZW; } response()->json(["\145\x72\x72\157\162" => "\x45\x68\150\x68\x21\40\x43\x61\156\40\x6e\x6f\164\x20\144\x65\x6c\x65\x74\145\x20\x74\150\151\x73\40\x6d\x61\156\x75\x66\141\143\x74\165\x72\145\x72"], 403); In1ZW: try { $yOq5R->update(["\x69\163\x5f\x64\145\154\145\x74\145\x64" => true]); } catch (\Exception $gQO23) { response()->json(["\145\162\162\157\x72" => $gQO23->getMessage()], 403); } return response()->json(null, 204); } public function destroyMultiple(Request $request) { goto fzh1d; QXLb9: wjqZD: $p38SA = $request->get("\151\x64\x73", []); $JjYky = Manufacturer::notDeleted()->whereIn("\x69\x64", $p38SA)->get(); goto SIcA1; fzh1d: $U09iK = Validator::make($request->all(), ["\151\x64\163" => "\162\145\x71\165\x69\162\x65\144"]); if (!$U09iK->fails()) { goto wjqZD; } return response()->json(["\x65\x72\162\157\x72\x73" => $U09iK->errors()], 403); goto QXLb9; c8h0z: try { Manufacturer::notDeleted()->whereIn("\x69\144", $p38SA)->update(["\x69\x73\x5f\x64\x65\154\145\164\145\x64" => true]); } catch (\Exception $gQO23) { response()->json(["\145\x72\162\157\x72" => $gQO23->getMessage()], 403); } return response()->json(null, 204); goto wJAuj; SIcA1: if (!($JjYky->count() <= 0)) { goto C5U21; } response()->json(["\145\162\162\x6f\x72" => "\115\x61\x6e\x75\x66\141\x63\164\165\162\145\162\x20\x69\x73\40\156\x6f\x74\40\166\141\x6c\x69\x64\x2e"], 403); C5U21: goto c8h0z; wJAuj: } public function activateMultiple(Request $request) { goto jJXgn; MhBVD: if (!($JjYky->count() <= 0)) { goto O8X_H; } response()->json(["\x65\162\162\157\x72" => "\x4d\141\156\165\146\141\x63\x74\x75\x72\x65\162\x20\x69\163\x20\156\x6f\x74\x20\166\141\154\x69\x64\x2e"], 403); O8X_H: goto V5Rjk; WstJa: FODXm: $p38SA = $request->get("\151\144\x73", []); $JjYky = Manufacturer::notDeleted()->whereIn("\x69\144", $p38SA)->get(); goto MhBVD; jJXgn: $U09iK = Validator::make($request->all(), ["\x69\x64\163" => "\x72\145\x71\x75\151\x72\145\x64"]); if (!$U09iK->fails()) { goto FODXm; } return response()->json(["\x65\x72\162\157\x72\x73" => $U09iK->errors()], 403); goto WstJa; V5Rjk: try { Manufacturer::notDeleted()->whereIn("\x69\x64", $p38SA)->update(["\x69\x73\137\141\x63\x74\x69\166\141\164\x65\x64" => true]); } catch (\Exception $gQO23) { response()->json(["\145\x72\162\x6f\162" => $gQO23->getMessage()], 403); } return response()->json(null, 204); goto O8i8l; O8i8l: } public function deactivateMultiple(Request $request) { goto v8MmV; ajfBN: c9ell: $p38SA = $request->get("\151\144\163", []); $JjYky = Manufacturer::notDeleted()->whereIn("\151\144", $p38SA)->get(); goto QH5FU; v8MmV: $U09iK = Validator::make($request->all(), ["\x69\144\x73" => "\162\145\161\165\x69\162\145\144"]); if (!$U09iK->fails()) { goto c9ell; } return response()->json(["\x65\162\162\x6f\162\163" => $U09iK->errors()], 403); goto ajfBN; PUmSW: try { Manufacturer::notDeleted()->whereIn("\151\x64", $p38SA)->update(["\151\163\x5f\141\143\x74\151\166\141\164\x65\x64" => false]); } catch (\Exception $gQO23) { response()->json(["\x65\x72\162\x6f\162" => $gQO23->getMessage()], 403); } return response()->json(null, 204); goto NlYl_; QH5FU: if (!($JjYky->count() <= 0)) { goto lOyyn; } response()->json(["\x65\x72\162\157\162" => "\115\x61\156\x75\x66\141\x63\x74\165\x72\145\162\x20\x69\163\40\x6e\x6f\x74\40\166\x61\x6c\x69\x64\56"], 403); lOyyn: goto PUmSW; NlYl_: } public function position(Request $request) { goto MK00G; CbPQA: nhtuz: NR4L9: return response()->json(null, 204); goto NDnzm; PgGB6: $hmC4z = $request->position; if (!is_array($hmC4z)) { goto NR4L9; } foreach ($hmC4z as $bD3_i) { Manufacturer::where("\151\x64", $bD3_i["\x69\x64"])->update(["\x70\x6f\163\151\x74\151\x6f\x6e" => $bD3_i["\x6f\162\144\145\162"]]); DmIud: } goto CbPQA; MK00G: if ($request->has("\160\x6f\x73\151\164\x69\x6f\156")) { goto TeO36; } return response()->json(["\x65\x72\x72\x6f\162\x73" => "\104\141\164\141\x20\x69\x73\40\151\x6e\166\141\154\x69\x64"], 403); TeO36: goto PgGB6; NDnzm: } private function detectParentCategoryId($Rgm84 = [], $koTHg = '') { $p38SA = []; foreach ($Rgm84 as $bD3_i) { if (!($bD3_i->id == $koTHg)) { goto CSkkY; } $p38SA[] = $bD3_i->id; $ykItD = $this->detectParentCategoryId($Rgm84, $bD3_i->parent_id); $p38SA = array_merge($p38SA, $ykItD); CSkkY: SZuDk: } yDyDl: return $p38SA; } }