<?php
//Obfuscated by YAK Pro - Php Obfuscator 2.0.13 at 2025-05-27 11:01:56
 namespace App\Http\Controllers\Admin; use App\Helpers\Helper; use App\Http\Controllers\Controller; use App\ProductOptionDetail; use Illuminate\Http\Request; use Illuminate\Support\Arr; use App\ProductOption; use App\Http\Resources\Admin\OptionResource; use Validator; class OptionController extends Controller { const ITEM_PER_PAGE = 100; public function index(Request $request) { goto WLUru; k3i2G: $d6gtu = Arr::get($gpoJ2, "\153\145\x79\167\x6f\162\144", ''); if (empty($d6gtu)) { goto DGeIO; } $SCx3C->where("\x6e\x61\155\145", "\114\111\x4b\105", "\45" . $d6gtu . "\45"); goto PsMfZ; PsMfZ: DGeIO: $SCx3C->orderBy("\x70\157\163\151\164\151\157\x6e")->orderBy("\151\x64"); return OptionResource::collection($SCx3C->paginate($RycrW)); goto zCdSk; WLUru: $gpoJ2 = $request->all(); $SCx3C = ProductOption::isTemplate(); $RycrW = Arr::get($gpoJ2, "\154\x69\x6d\151\164", static::ITEM_PER_PAGE); goto k3i2G; zCdSk: } public function all(Request $request) { $gpoJ2 = $request->all(); $RycrW = Arr::get($gpoJ2, "\x6c\151\x6d\x69\164", static::ITEM_PER_PAGE); $SCx3C = ProductOption::select("\151\144", "\156\141\155\x65")->isTemplate()->orderBy("\160\x6f\x73\x69\x74\151\x6f\x6e")->orderBy("\x69\144"); return OptionResource::collection($SCx3C->paginate($RycrW)); } public function available(Request $request) { goto SCCPG; SCCPG: $klS32 = Arr::get($request->all(), "\151\147\x6e\x6f\x72\145\x49\x64", ''); $SCx3C = ProductOption::select("\151\x64", "\x6e\141\155\x65")->isTemplate(); if (!($klS32 != null && $klS32 != '')) { goto yRIAu; } goto fMoGX; fMoGX: $SCx3C->where("\151\144", "\41\75", $klS32); yRIAu: $SCx3C->orderBy("\x70\157\x73\x69\x74\151\157\x6e")->orderBy("\151\144"); goto cwLUE; cwLUE: return OptionResource::collection($SCx3C->get()); goto VmbU0; VmbU0: } public function show($zotM4 = 0) { $oBn43 = ProductOption::with("\x64\x65\x74\141\x69\x6c\163")->isTemplate()->where("\151\144", $zotM4)->first(); if (isset($oBn43)) { goto lv9f1; } return response()->json(["\145\x72\x72\157\x72\163" => "\x4f\x70\164\151\x6f\x6e\40\x69\x73\40\x6e\157\x74\x20\166\141\154\151\144"], 403); lv9f1: return new OptionResource($oBn43); } public function store(Request $request) { goto pNzdc; pNzdc: $eSX_l = Validator::make($request->all(), ["\x6e\x61\x6d\x65" => ["\x72\x65\x71\165\x69\162\x65\x64"]]); if (!$eSX_l->fails()) { goto OL4Kc; } return response()->json(["\145\162\162\x6f\x72\x73" => $eSX_l->errors()], 403); goto Mk8Vo; WC1FS: $cnffX = isset($lNk6R) ? $lNk6R->position : 0; if (!($cnffX > 0)) { goto HuShM; } $cnffX++; goto SBLcp; Mk8Vo: OL4Kc: $params = $request->all(); $lNk6R = ProductOption::isTemplate()->orderBy("\x70\x6f\x73\151\x74\151\x6f\156", "\144\145\x73\143")->first(); goto WC1FS; hflYb: vYwdx: return new OptionResource($oBn43); goto X9gno; SBLcp: HuShM: $oBn43 = ProductOption::create(["\156\x61\x6d\x65" => $params["\156\141\155\145"], "\163\154\165\147" => Helper::slug($params["\156\x61\155\x65"]), "\x64\145\163\143\162\151\x70\164\151\157\156" => $params["\x64\145\163\143\x72\x69\x70\x74\x69\x6f\x6e"], "\151\163\x5f\164\145\155\160\x6c\141\x74\145" => $params["\151\163\137\x74\145\155\160\154\x61\164\145"], "\160\157\x73\151\164\151\x6f\156" => $cnffX, "\x63\x72\x65\x61\x74\145\144\x5f\x61\164" => date("\131\x2d\155\x2d\x64\x20\110\72\151\72\163"), "\165\160\144\x61\x74\145\x64\137\x61\164" => date("\131\x2d\155\55\x64\40\x48\72\x69\x3a\x73")]); foreach ($params["\x64\x65\164\x61\151\154\x73"] as $DAupK) { ProductOptionDetail::create(["\x70\x72\x6f\144\165\143\164\x5f\x6f\160\164\x69\157\x6e\137\x69\144" => $oBn43->id, "\156\141\155\x65" => $DAupK["\x6e\x61\x6d\145"], "\x73\x6c\165\147" => Helper::slug($DAupK["\156\141\155\145"]), "\151\x6d\x61\x67\145" => $DAupK["\151\x6d\141\147\x65"], "\x70\x6f\x73\151\x74\151\x6f\x6e" => 0, "\x69\163\137\x63\150\145\143\153" => true, "\x63\x72\x65\141\164\145\x64\x5f\x61\164" => date("\131\55\155\x2d\x64\x20\x48\72\x69\72\163"), "\165\x70\x64\x61\x74\145\144\x5f\x61\164" => date("\x59\55\155\55\144\x20\110\x3a\x69\72\x73")]); U5_6O: } goto hflYb; X9gno: } public function update(Request $request, $zotM4 = 0) { goto jJ9HP; H8q7d: sQF5P: $oBn43 = ProductOption::isTemplate()->where("\151\x64", $zotM4)->first(); if (isset($oBn43)) { goto B63WX; } goto C_BkE; dwbnn: bouw1: return response()->json(null, 204); goto NuCZJ; C_BkE: return response()->json(["\x65\162\162\x6f\x72\163" => "\x4f\x70\164\151\x6f\x6e\x20\x69\163\40\156\157\x74\40\166\x61\154\151\144"], 403); B63WX: $params = $request->all(); goto snmiw; jJ9HP: $eSX_l = Validator::make($request->all(), ["\156\141\155\145" => ["\162\x65\x71\x75\151\162\x65\x64"]]); if (!$eSX_l->fails()) { goto sQF5P; } return response()->json(["\145\x72\162\x6f\x72\x73" => $eSX_l->errors()], 403); goto H8q7d; snmiw: $oBn43->update(["\x6e\x61\x6d\145" => $params["\x6e\x61\x6d\x65"], "\163\154\x75\147" => Helper::slug($params["\x6e\x61\x6d\145"]), "\x64\145\x73\x63\162\x69\x70\164\151\x6f\x6e" => $params["\144\145\x73\x63\162\x69\160\x74\151\157\x6e"], "\x69\163\137\164\145\x6d\x70\154\x61\x74\x65" => $params["\151\x73\137\164\145\x6d\x70\154\x61\x74\145"], "\x75\160\x64\x61\164\x65\144\137\x61\x74" => date("\x59\55\155\55\144\x20\110\x3a\151\x3a\x73")]); ProductOptionDetail::where("\x70\162\x6f\144\x75\x63\164\x5f\157\160\164\151\157\x6e\x5f\x69\x64", $oBn43->id)->delete(); foreach ($params["\x64\145\164\141\151\154\x73"] as $DAupK) { ProductOptionDetail::create(["\160\162\x6f\144\x75\x63\x74\x5f\x6f\x70\x74\x69\x6f\x6e\137\x69\x64" => $oBn43->id, "\x6e\141\155\145" => $DAupK["\156\141\x6d\145"], "\x73\x6c\165\x67" => Helper::slug($DAupK["\x6e\141\x6d\145"]), "\x69\155\141\147\x65" => $DAupK["\x69\x6d\x61\147\145"], "\x70\157\x73\x69\x74\151\x6f\156" => 0, "\x69\x73\137\143\x68\x65\x63\153" => true, "\143\162\x65\141\x74\x65\144\x5f\141\164" => date("\131\x2d\x6d\55\x64\x20\110\x3a\151\x3a\x73"), "\x75\x70\x64\x61\x74\x65\x64\x5f\x61\164" => date("\x59\55\155\x2d\144\40\x48\72\x69\x3a\163")]); RqHaz: } goto dwbnn; NuCZJ: } public function destroy($zotM4 = 0) { $oBn43 = ProductOption::isTemplate()->where("\151\x64", $zotM4)->first(); if (isset($oBn43)) { goto F22UB; } response()->json(["\145\162\162\x6f\162" => "\x45\150\150\150\41\40\x43\141\x6e\40\x6e\x6f\x74\40\x64\145\x6c\x65\164\145\x20\x74\x68\151\x73\40\x4f\160\164\151\157\x6e"], 403); F22UB: try { $oBn43->delete(); } catch (\Exception $lD8tB) { response()->json(["\x65\x72\x72\x6f\162" => $lD8tB->getMessage()], 403); } return response()->json(null, 204); } public function destroyMultiple(Request $request) { goto KyMPn; KyMPn: $eSX_l = Validator::make($request->all(), ["\151\144\163" => "\x72\x65\161\x75\x69\162\x65\144"]); if (!$eSX_l->fails()) { goto t0q5x; } return response()->json(["\145\162\162\157\x72\163" => $eSX_l->errors()], 403); goto VE9zG; z2pQH: if (!($OxSPH->count() <= 0)) { goto aSfjR; } response()->json(["\x65\162\162\157\x72" => "\x4f\x70\164\151\x6f\x6e\40\151\x73\x20\156\x6f\164\x20\x76\141\x6c\x69\144\56"], 403); aSfjR: goto Kk5Gm; VE9zG: t0q5x: $mlDrB = $request->get("\x69\x64\163", []); $OxSPH = ProductOption::isTemplate()->whereIn("\x69\144", $mlDrB)->get(); goto z2pQH; Kk5Gm: try { ProductOption::isTemplate()->whereIn("\x69\144", $mlDrB)->delete(); } catch (\Exception $lD8tB) { response()->json(["\x65\162\x72\x6f\162" => $lD8tB->getMessage()], 403); } return response()->json(null, 204); goto YaAVF; YaAVF: } public function activateMultiple(Request $request) { goto MZtUj; Ux452: try { } catch (\Exception $lD8tB) { response()->json(["\145\x72\162\x6f\x72" => $lD8tB->getMessage()], 403); } return response()->json(null, 204); goto Tv1Lu; JXejJ: if (!($OxSPH->count() <= 0)) { goto dKH6c; } response()->json(["\145\162\162\157\162" => "\x4f\x70\164\151\157\x6e\x20\x69\x73\40\156\x6f\x74\40\x76\141\x6c\151\144\x2e"], 403); dKH6c: goto Ux452; MZtUj: $eSX_l = Validator::make($request->all(), ["\x69\x64\163" => "\162\145\x71\x75\151\x72\145\x64"]); if (!$eSX_l->fails()) { goto sve9A; } return response()->json(["\x65\162\162\x6f\162\163" => $eSX_l->errors()], 403); goto l1zEw; l1zEw: sve9A: $mlDrB = $request->get("\151\x64\163", []); $OxSPH = ProductOption::isTemplate()->whereIn("\151\144", $mlDrB)->get(); goto JXejJ; Tv1Lu: } public function deactivateMultiple(Request $request) { goto Q9mTt; MfWxf: try { } catch (\Exception $lD8tB) { response()->json(["\x65\x72\x72\x6f\162" => $lD8tB->getMessage()], 403); } return response()->json(null, 204); goto BvIV4; YPbSM: qq4aO: $mlDrB = $request->get("\x69\144\x73", []); $OxSPH = ProductOption::isTemplate()->whereIn("\151\144", $mlDrB)->get(); goto p6iL1; Q9mTt: $eSX_l = Validator::make($request->all(), ["\x69\x64\x73" => "\162\x65\x71\x75\151\162\x65\x64"]); if (!$eSX_l->fails()) { goto qq4aO; } return response()->json(["\145\162\x72\157\162\163" => $eSX_l->errors()], 403); goto YPbSM; p6iL1: if (!($OxSPH->count() <= 0)) { goto y91PC; } response()->json(["\x65\162\x72\157\x72" => "\117\160\164\x69\x6f\x6e\x20\151\163\x20\156\x6f\x74\x20\x76\x61\x6c\x69\144\x2e"], 403); y91PC: goto MfWxf; BvIV4: } public function position(Request $request) { goto g7QQO; J4FqS: dOFV9: pPdV8: return response()->json(null, 204); goto eNLJA; g7QQO: if ($request->has("\x70\157\x73\x69\x74\151\157\156")) { goto ToGC1; } return response()->json(["\x65\162\x72\157\x72\x73" => "\104\x61\x74\141\40\x69\163\x20\x69\x6e\166\x61\x6c\151\x64"], 403); ToGC1: goto ew_ED; ew_ED: $Ycctd = $request->position; if (!is_array($Ycctd)) { goto pPdV8; } foreach ($Ycctd as $DAupK) { ProductOption::where("\x69\x64", $DAupK["\151\144"])->update(["\x70\x6f\163\151\x74\151\x6f\156" => $DAupK["\x6f\x72\x64\x65\x72"]]); YGs03: } goto J4FqS; eNLJA: } }