<?php
//Obfuscated by YAK Pro - Php Obfuscator 2.0.13 at 2025-05-27 11:01:52
 namespace App\Http\Controllers\Admin; use App\Department; use App\Employee; use App\Http\Controllers\Controller; use App\Http\Resources\Admin\DepartmentResource; use Illuminate\Http\Request; use Illuminate\Support\Arr; use Validator; class DepartmentController extends Controller { const ITEM_PER_PAGE = 100; public function index(Request $request) { goto k_cgS; fClFo: return DepartmentResource::collection($t7GWH->paginate($gMmsA)); goto vAL2U; vMv_9: $t7GWH->where("\x69\163\137\x61\x63\x74\151\x76\141\x74\x65\144", $jkkEx); eXabX: $t7GWH->orderBy("\151\144"); goto fClFo; EhFEX: $uFYR6 = Arr::get($wWdx1, "\153\x65\x79\167\157\162\x64", ''); $jkkEx = Arr::get($wWdx1, "\x73\x74\141\x74\x75\x73", ''); if (empty($uFYR6)) { goto s5vmZ; } goto donTT; k_cgS: $wWdx1 = $request->all(); $t7GWH = Department::query(); $gMmsA = Arr::get($wWdx1, "\x6c\151\155\x69\x74", static::ITEM_PER_PAGE); goto EhFEX; donTT: $t7GWH->where(function ($Onk2r) use($uFYR6) { $Onk2r->where("\156\x61\x6d\145", "\x4c\x49\113\x45", "\45" . $uFYR6 . "\45")->orWhere("\143\157\x64\x65", "\x4c\x49\113\105", "\45" . $uFYR6 . "\x25"); }); s5vmZ: if (!($jkkEx != null && $jkkEx != '' && ($jkkEx == "\60" || $jkkEx == "\x31"))) { goto eXabX; } goto vMv_9; vAL2U: } public function all(Request $request) { $wWdx1 = $request->all(); $gMmsA = Arr::get($wWdx1, "\154\151\x6d\x69\164", static::ITEM_PER_PAGE); $t7GWH = Department::select("\x69\x64", "\156\141\x6d\145", "\143\x6f\x64\145")->orderBy("\151\x64"); return DepartmentResource::collection($t7GWH->paginate($gMmsA)); } public function allNested(Request $request) { goto IxyH0; k0Nqs: $t7GWH = $t7GWH->where("\x69\144", "\41\x3d", $BIeyj); R9crI: $t7GWH = $t7GWH->orderBy("\x69\144")->get(); goto BuOSJ; BuOSJ: $bZcUr = $this->getChildItems($t7GWH, null); return response()->json(["\144\141\164\x61" => $bZcUr], 200); goto vGv12; IxyH0: $BIeyj = Arr::get($request->all(), "\x69\x67\x6e\x6f\162\145\111\144", ''); $t7GWH = Department::select("\x2a")->isActivated(); if (!($BIeyj != null && $BIeyj != '')) { goto R9crI; } goto k0Nqs; vGv12: } public function getChildItems($t7GWH, $dud0B = 0) { $bZcUr = []; foreach ($t7GWH as $xxPIc) { goto CvAee; CvAee: if (!($xxPIc->parent_id == $dud0B)) { goto amIA9; } $bjKMN = ["\166\141\154\x75\x65" => $xxPIc->id, "\x6c\141\142\145\154" => $xxPIc->name]; $F1Ynz = $this->getChildItems($t7GWH, $xxPIc->id); goto vOQiq; vOQiq: if (!($F1Ynz !== null && count($F1Ynz) > 0)) { goto zR0T2; } $bjKMN["\x63\150\x69\154\144\x72\x65\156"] = $F1Ynz; zR0T2: goto Cy3Ch; Cy3Ch: $bZcUr[] = $bjKMN; amIA9: uS_QX: goto MHW02; MHW02: } fac2Y: return $bZcUr; } public function available(Request $request) { goto UcJOi; UcJOi: $BIeyj = Arr::get($request->all(), "\x69\x67\x6e\x6f\x72\x65\111\144", ''); $t7GWH = Department::select("\x69\144", "\x6e\x61\x6d\145", "\x63\x6f\x64\x65")->where("\x69\x73\137\x61\x63\164\x69\166\x61\164\145\144", true); if (!($BIeyj != null && $BIeyj != '')) { goto eGULK; } goto oJzhM; MFHDS: return DepartmentResource::collection($t7GWH->get()); goto kBwb_; oJzhM: $t7GWH->where("\x69\144", "\41\75", $BIeyj); eGULK: $t7GWH->orderBy("\151\144"); goto MFHDS; kBwb_: } public function show($ChY_P = 0) { $O94wi = Department::findOrFail($ChY_P); return new DepartmentResource($O94wi); } public function store(Request $request) { goto rqtzl; rqtzl: $J6CUe = Validator::make($request->all(), ["\x6e\141\x6d\145" => ["\162\x65\x71\x75\151\x72\x65\144"], "\143\x6f\144\145" => ["\162\145\x71\165\151\x72\x65\144", "\165\156\x69\x71\x75\x65\x3a\144\145\x70\x61\x72\x74\155\x65\156\164\x73\x2c\143\157\144\x65"], "\x69\x73\x5f\x61\143\164\x69\x76\141\164\145\144" => ["\162\145\x71\165\x69\162\x65\x64"]]); if (!$J6CUe->fails()) { goto UNew0; } return response()->json(["\x65\x72\x72\x6f\162\163" => $J6CUe->errors()], 403); goto Clpxs; MhKNV: if (!(is_array($params["\160\x61\162\145\156\164\x5f\151\144"]) && isset($params["\160\x61\x72\145\x6e\x74\x5f\x69\x64"][array_key_last($params["\x70\141\x72\145\x6e\x74\x5f\x69\144"])]))) { goto iSaQN; } $Da4Tz = $params["\x70\141\162\x65\156\164\137\x69\144"][array_key_last($params["\x70\x61\x72\145\x6e\164\137\x69\x64"])]; iSaQN: goto uZj1g; uZj1g: $O94wi = Department::create(["\156\x61\155\145" => $params["\x6e\x61\x6d\145"], "\143\157\144\x65" => $params["\143\x6f\x64\x65"], "\x70\141\x72\145\x6e\164\x5f\x69\144" => $Da4Tz, "\x69\x73\x5f\141\x63\164\151\x76\141\164\x65\x64" => $params["\151\163\137\x61\143\164\151\166\141\x74\145\144"] === true ? 1 : 0]); return new DepartmentResource($O94wi); goto Gnzob; Clpxs: UNew0: $params = $request->all(); $Da4Tz = null; goto MhKNV; Gnzob: } public function update(Request $request, $ChY_P = 0) { goto E841Y; ust15: lAC3s: $O94wi = Department::findOrFail($ChY_P); $params = $request->all(); goto lItEn; E841Y: $J6CUe = Validator::make($request->all(), ["\156\x61\x6d\145" => ["\162\145\161\x75\x69\x72\x65\144"], "\x63\x6f\x64\145" => ["\162\x65\x71\165\x69\x72\145\144", "\x75\x6e\151\161\165\x65\x3a\x64\x65\160\141\x72\x74\155\145\156\164\163\54\x63\157\144\x65\x2c" . $ChY_P], "\x69\163\x5f\x61\143\x74\151\x76\141\x74\x65\144" => ["\x72\x65\161\x75\151\x72\145\144"]]); if (!$J6CUe->fails()) { goto lAC3s; } return response()->json(["\x65\x72\162\x6f\x72\163" => $J6CUe->errors()], 403); goto ust15; lItEn: $Da4Tz = null; if (!(is_array($params["\x70\x61\162\x65\156\164\x5f\x69\144"]) && isset($params["\x70\141\x72\145\156\164\x5f\x69\x64"][array_key_last($params["\160\141\x72\145\x6e\164\137\151\x64"])]))) { goto KJFG1; } $Da4Tz = $params["\160\141\x72\x65\x6e\x74\137\151\x64"][array_key_last($params["\x70\x61\x72\145\156\164\137\151\144"])]; goto Mk73B; Mk73B: KJFG1: $O94wi->update(["\x6e\141\x6d\145" => $params["\x6e\x61\x6d\145"], "\x63\x6f\x64\x65" => $params["\143\x6f\144\x65"], "\160\x61\x72\145\156\164\137\x69\x64" => $Da4Tz, "\x69\x73\x5f\x61\x63\x74\151\166\x61\x74\x65\x64" => $params["\x69\x73\x5f\x61\x63\x74\x69\x76\141\x74\x65\x64"] === true ? 1 : 0]); return response()->json(null, 204); goto URVsf; URVsf: } public function destroy($ChY_P = 0) { goto dNhsA; dNhsA: $O94wi = Department::findOrFail($ChY_P); $FFBBB = Department::where("\x70\141\x72\x65\x6e\x74\x5f\x69\144", $O94wi->id)->count(); if (!($FFBBB > 0)) { goto mvZxU; } goto RsFbZ; cZfGC: $O94wi->delete(); return response()->json(null, 204); goto ltgYP; OHA2m: if (!($FQJT2 > 0)) { goto MKTfL; } return response()->json(["\145\x72\x72\157\x72\163" => "\103\x61\156\x20\x6e\x6f\164\x20\144\x65\x6c\x65\x74\x65\x20\164\150\151\163\40\x64\x65\x70\141\162\164\155\145\156\x74"], 403); MKTfL: goto cZfGC; RsFbZ: return response()->json(["\x65\x72\162\157\162\163" => "\103\141\x6e\40\156\x6f\x74\x20\144\145\x6c\145\164\x65\40\164\150\151\163\x20\144\145\x70\141\162\x74\x6d\x65\x6e\x74"], 403); mvZxU: $FQJT2 = Employee::where("\144\x65\x70\141\x72\164\155\x65\x6e\x74\137\x69\x64", $O94wi->id)->count(); goto OHA2m; ltgYP: } public function destroyMultiple(Request $request) { goto hOMf5; b8ceX: return response()->json(null, 204); goto TdeMC; YOyL1: HUCAE: $xv_P5 = $request->get("\x69\144\x73", []); Department::whereIn("\151\x64", $xv_P5)->delete(); goto b8ceX; hOMf5: $J6CUe = Validator::make($request->all(), ["\151\144\163" => "\162\x65\161\165\x69\162\145\144"]); if (!$J6CUe->fails()) { goto HUCAE; } return response()->json(["\145\x72\x72\x6f\162\x73" => $J6CUe->errors()], 403); goto YOyL1; TdeMC: } public function activateMultiple(Request $request) { goto g1KLl; g1KLl: $J6CUe = Validator::make($request->all(), ["\x69\144\163" => "\x72\145\x71\x75\151\x72\x65\x64"]); if (!$J6CUe->fails()) { goto VYqJN; } return response()->json(["\145\162\162\157\x72\163" => $J6CUe->errors()], 403); goto h3xUj; h3xUj: VYqJN: $xv_P5 = $request->get("\x69\144\x73", []); Department::whereIn("\151\144", $xv_P5)->update(["\151\x73\x5f\x61\x63\x74\x69\166\x61\164\x65\144" => true]); goto mdvhh; mdvhh: return response()->json(null, 204); goto R8mmo; R8mmo: } public function deactivateMultiple(Request $request) { goto uL2gJ; N8sup: return response()->json(null, 204); goto sKJnL; YU6j2: qPo9e: $xv_P5 = $request->get("\x69\x64\163", []); Department::whereIn("\x69\144", $xv_P5)->update(["\151\x73\137\x61\x63\x74\x69\x76\x61\164\145\144" => false]); goto N8sup; uL2gJ: $J6CUe = Validator::make($request->all(), ["\151\144\163" => "\x72\145\161\x75\x69\162\x65\x64"]); if (!$J6CUe->fails()) { goto qPo9e; } return response()->json(["\x65\x72\162\157\162\x73" => $J6CUe->errors()], 403); goto YU6j2; sKJnL: } }