<?php
//Obfuscated by YAK Pro - Php Obfuscator 2.0.13 at 2025-05-27 11:01:59
 namespace App\Http\Controllers\Admin; use App\EmailTemplateAttachment; use App\Http\Controllers\Controller; use Illuminate\Http\Request; use Illuminate\Support\Arr; use App\EmailTemplate; use App\Http\Resources\Admin\EmailTemplateResource; use Validator; class TemplateController extends Controller { const ITEM_PER_PAGE = 20; public function index(Request $request) { goto pR1TX; fGLgI: return EmailTemplateResource::collection($Gkdpq->paginate($NDFVe)); goto AmpBv; Bylui: $a3ZfM = Arr::get($sJOHW, "\x6b\x65\171\x77\157\x72\144", ''); $KA6pY = Arr::get($sJOHW, "\163\164\141\x74\x75\163", ''); if (empty($a3ZfM)) { goto ukZXq; } goto IQrEc; IQrEc: $Gkdpq->where("\156\141\155\x65", "\114\111\x4b\105", "\45" . $a3ZfM . "\45"); ukZXq: if (!($KA6pY != '')) { goto bnS8M; } goto zW7hr; pR1TX: $sJOHW = $request->all(); $Gkdpq = EmailTemplate::notDeleted(); $NDFVe = Arr::get($sJOHW, "\154\151\155\151\164", static::ITEM_PER_PAGE); goto Bylui; zW7hr: $Gkdpq->where("\x69\163\137\x61\143\164\151\166\141\x74\x65\x64", $KA6pY); bnS8M: $Gkdpq->orderBy("\x69\x64"); goto fGLgI; AmpBv: } public function all(Request $request) { $sJOHW = $request->all(); $NDFVe = Arr::get($sJOHW, "\154\x69\x6d\151\164", static::ITEM_PER_PAGE); $Gkdpq = EmailTemplate::select("\52")->notDeleted()->orderBy("\x69\x64"); return EmailTemplateResource::collection($Gkdpq->paginate($NDFVe)); } public function show($ZmV0a = 0) { $RDeNC = EmailTemplate::notDeleted()->where("\151\144", $ZmV0a)->first(); if (isset($RDeNC)) { goto ivF5u; } return response()->json(["\145\x72\x72\x6f\162\x73" => "\124\x65\x6d\160\154\x61\x74\145\40\151\163\x20\x6e\x6f\164\40\x76\x61\154\x69\144"], 403); ivF5u: return new EmailTemplateResource($RDeNC); } public function store(Request $request) { goto sYnj2; n0u81: uvfbg: $params = $request->all(); $cVD4Z = EmailTemplate::notDeleted()->where("\x6e\141\x6d\145", $params["\156\x61\x6d\x65"])->first(); goto CcTC1; CpBGv: $RDeNC = EmailTemplate::create(["\156\141\155\145" => $params["\156\x61\x6d\145"], "\x74\171\x70\145" => $params["\164\171\160\145"], "\x64\x65\163\x63\x72\151\160\164\151\x6f\156" => $params["\x64\145\163\143\162\151\x70\164\151\157\156"], "\x74\151\x74\x6c\x65" => $this->_snippetCodeFormat($params["\x74\x69\x74\154\x65"]), "\143\x6f\156\164\145\x6e\164" => $this->_snippetCodeFormat($params["\x63\157\x6e\164\x65\156\164"]), "\x67\x72\x6f\x75\160" => $params["\147\x72\x6f\x75\160"], "\165\x73\145\162\x5f\151\x64" => auth("\x61\x70\151")->user()->id, "\151\163\x5f\x61\143\x74\151\166\141\164\145\x64" => $params["\x69\163\x5f\x61\143\x74\x69\x76\141\x74\x65\x64"] === true ? 1 : 0, "\143\x72\x65\x61\164\x65\144\x5f\141\164" => date("\x59\55\155\55\x64\x20\x48\72\151\72\x73"), "\x75\160\x64\x61\x74\x65\144\x5f\141\x74" => date("\131\55\155\55\144\x20\110\72\151\72\163")]); if (!isset($params["\x61\164\164\x61\x63\x68\x6d\145\156\164\163"])) { goto DpFqT; } $g3lLZ = []; goto ClXC2; IZKvG: EmailTemplateAttachment::insert($g3lLZ); tN6PU: DpFqT: goto ZaeNo; ClXC2: foreach ($params["\x61\x74\x74\141\143\150\x6d\145\x6e\x74\163"] as $Bo6D4) { $g3lLZ[] = ["\x65\155\x61\x69\x6c\x5f\164\145\x6d\160\154\x61\164\145\x5f\151\x64" => $RDeNC->id, "\164\151\164\x6c\x65" => $Bo6D4["\142\x61\x73\x65\x4e\141\x6d\x65"], "\x66\151\x6c\145\137\x6e\141\x6d\145" => $Bo6D4["\x66\x69\154\145\137\x6e\141\155\x65"], "\x66\151\x6c\145\137\x74\x79\x70\145" => $Bo6D4["\164\x79\x70\x65"], "\x66\151\154\x65\137\x73\x69\x7a\x65" => $Bo6D4["\163\x69\172\145"], "\146\x69\x6c\145\x5f\x65\170\164\145\x6e\163\151\x6f\x6e" => $Bo6D4["\145\170\x74\x65\156\163\x69\x6f\x6e"], "\x63\162\145\x61\164\145\x64\137\141\164" => date("\x59\55\x6d\x2d\x64\40\110\x3a\x69\x3a\x73"), "\165\x70\x64\141\164\145\x64\x5f\141\164" => date("\x59\55\155\x2d\144\40\x48\x3a\x69\x3a\163")]; p8xSW: } EHu4X: if (!(count($g3lLZ) > 0)) { goto tN6PU; } goto IZKvG; sYnj2: $CIJ3T = Validator::make($request->all(), ["\156\141\155\x65" => ["\x72\x65\161\x75\x69\x72\x65\144"], "\164\x79\160\145" => ["\162\x65\161\165\151\162\145\144"], "\x74\151\164\x6c\x65" => ["\x72\x65\161\x75\x69\x72\145\144"], "\143\x6f\156\x74\145\156\164" => ["\x72\145\x71\165\151\162\x65\x64"], "\x67\162\x6f\165\x70" => ["\162\145\161\165\x69\x72\145\x64"], "\x69\163\x5f\141\x63\x74\x69\166\x61\164\145\144" => ["\x72\x65\161\165\151\162\x65\144"]]); if (!$CIJ3T->fails()) { goto uvfbg; } return response()->json(["\x65\162\162\x6f\x72\x73" => $CIJ3T->errors()], 403); goto n0u81; CcTC1: if (!$cVD4Z) { goto bCm3M; } return response()->json(["\x65\x72\x72\157\162\163" => "\124\145\155\x70\x6c\141\164\x65\x20\141\x6c\x72\145\141\x64\x79\40\x65\170\x69\x73\164\163\56"], 403); bCm3M: goto CpBGv; ZaeNo: return new EmailTemplateResource($RDeNC); goto tXitE; tXitE: } public function update(Request $request, $ZmV0a = 0) { goto J4EOA; JiZi8: $cVD4Z = EmailTemplate::notDeleted()->where("\151\144", "\x21\x3d", $ZmV0a)->where("\156\141\155\x65", $params["\156\141\155\145"])->first(); if (!$cVD4Z) { goto h3UTd; } return response()->json(["\x65\162\162\157\x72\163" => "\124\x65\x6d\x70\x6c\141\164\x65\40\x61\154\x72\x65\x61\x64\x79\x20\145\x78\151\163\164\x73\x2e"], 403); goto FQ6vt; J4EOA: $CIJ3T = Validator::make($request->all(), ["\156\141\155\145" => ["\x72\145\x71\165\x69\162\145\144"], "\164\x79\x70\145" => ["\162\x65\161\165\x69\162\x65\144"], "\164\x69\164\154\x65" => ["\162\145\161\165\151\x72\x65\144"], "\x63\157\156\x74\x65\x6e\164" => ["\x72\x65\x71\165\x69\162\145\144"], "\147\x72\x6f\165\160" => ["\x72\145\161\x75\151\162\145\x64"], "\x69\x73\137\141\143\164\x69\166\141\164\145\x64" => ["\162\145\161\165\x69\x72\145\144"]]); if (!$CIJ3T->fails()) { goto CA44H; } return response()->json(["\145\x72\162\x6f\162\x73" => $CIJ3T->errors()], 403); goto CCgO5; zNE0C: EmailTemplateAttachment::where("\x65\155\x61\151\154\137\164\x65\155\x70\154\x61\164\145\137\151\144", $RDeNC->id)->delete(); $g3lLZ = []; foreach ($params["\x61\164\164\141\143\x68\x6d\145\x6e\x74\x73"] as $Bo6D4) { $g3lLZ[] = ["\145\155\x61\151\154\137\x74\x65\155\x70\154\x61\x74\145\137\x69\x64" => $RDeNC->id, "\164\x69\x74\x6c\x65" => $Bo6D4["\x62\141\163\145\x4e\x61\155\145"], "\146\x69\154\x65\137\x6e\x61\155\x65" => $Bo6D4["\146\x69\154\145\x5f\156\x61\x6d\x65"], "\x66\x69\x6c\145\137\164\x79\160\145" => $Bo6D4["\164\x79\160\145"], "\x66\x69\x6c\x65\137\x73\x69\172\145" => $Bo6D4["\163\x69\172\145"], "\x66\151\x6c\x65\x5f\x65\170\x74\145\x6e\163\151\157\156" => $Bo6D4["\145\x78\164\x65\156\x73\x69\157\156"], "\143\x72\x65\x61\x74\145\144\x5f\141\164" => date("\131\x2d\x6d\55\144\x20\x48\72\151\72\x73"), "\x75\160\144\141\x74\x65\x64\x5f\x61\x74" => date("\x59\x2d\155\55\x64\x20\110\x3a\x69\72\163")]; iKsKD: } goto Q7fuy; FQ6vt: h3UTd: $RDeNC->update(["\156\x61\155\x65" => $params["\x6e\141\x6d\x65"], "\x74\171\x70\x65" => $params["\164\171\160\145"], "\144\x65\163\143\x72\151\160\164\151\157\x6e" => $params["\144\x65\163\143\x72\x69\x70\164\x69\157\x6e"], "\164\151\x74\x6c\145" => $this->_snippetCodeFormat($params["\164\x69\164\x6c\145"]), "\143\x6f\x6e\164\x65\x6e\x74" => $this->_snippetCodeFormat($params["\x63\x6f\x6e\164\x65\156\164"]), "\x67\162\157\165\160" => $params["\147\x72\157\x75\x70"], "\x75\163\x65\x72\137\151\144" => auth("\141\160\x69")->user()->id, "\151\x73\137\141\x63\x74\151\x76\141\x74\145\x64" => $params["\x69\163\x5f\x61\143\x74\x69\x76\141\164\x65\144"] === true ? 1 : 0, "\x75\x70\x64\141\x74\x65\144\137\x61\x74" => date("\131\x2d\155\55\144\40\110\x3a\151\72\x73")]); if (!isset($params["\x61\x74\164\141\x63\150\155\x65\x6e\164\x73"])) { goto b02H9; } goto zNE0C; xIDgq: ZYhE1: b02H9: return response()->json(null, 204); goto prKil; CCgO5: CA44H: $RDeNC = EmailTemplate::notDeleted()->where("\151\144", $ZmV0a)->first(); if (isset($RDeNC)) { goto CoAwk; } goto SgmtE; SgmtE: return response()->json(["\145\162\x72\157\x72\x73" => "\124\x65\x6d\160\154\x61\164\x65\40\151\x73\x20\x6e\157\x74\x20\166\141\154\x69\x64"], 403); CoAwk: $params = $request->all(); goto JiZi8; Q7fuy: S4ez_: if (!(count($g3lLZ) > 0)) { goto ZYhE1; } EmailTemplateAttachment::insert($g3lLZ); goto xIDgq; prKil: } public function destroy($ZmV0a = 0) { $RDeNC = EmailTemplate::notDeleted()->where("\x69\x64", $ZmV0a)->first(); if (isset($RDeNC)) { goto Y6Cym; } response()->json(["\145\162\x72\x6f\x72" => "\105\x68\x68\150\41\x20\x43\x61\x6e\x20\156\157\164\x20\x64\x65\x6c\x65\164\145\40\x74\x68\151\163\x20\164\145\x6d\160\154\141\x74\x65"], 403); Y6Cym: try { $RDeNC->update(["\x69\163\137\144\x65\154\x65\x74\x65\x64" => true, "\165\160\x64\x61\164\145\144\x5f\141\164" => date("\131\55\x6d\55\x64\40\110\72\151\72\163")]); } catch (\Exception $PzjkC) { response()->json(["\145\x72\162\x6f\162" => $PzjkC->getMessage()], 403); } return response()->json(null, 204); } public function destroyMultiple(Request $request) { goto mkKAY; AJ4Uj: gltxJ: $Jcoyf = $request->get("\x69\144\163", []); $BsKei = EmailTemplate::notDeleted()->whereIn("\x69\144", $Jcoyf)->get(); goto ON8nX; YWws1: try { EmailTemplate::notDeleted()->whereIn("\x69\x64", $Jcoyf)->update(["\151\x73\137\144\145\154\145\164\x65\x64" => true, "\x75\160\x64\x61\x74\145\144\137\141\164" => date("\131\55\155\x2d\x64\x20\x48\x3a\151\72\x73")]); } catch (\Exception $PzjkC) { response()->json(["\145\x72\x72\x6f\x72" => $PzjkC->getMessage()], 403); } return response()->json(null, 204); goto kUcH9; mkKAY: $CIJ3T = Validator::make($request->all(), ["\151\144\x73" => "\x72\145\x71\x75\x69\x72\x65\144"]); if (!$CIJ3T->fails()) { goto gltxJ; } return response()->json(["\x65\x72\x72\x6f\162\163" => $CIJ3T->errors()], 403); goto AJ4Uj; ON8nX: if (!($BsKei->count() <= 0)) { goto QAEQS; } response()->json(["\x65\162\x72\157\162" => "\124\x65\x6d\160\154\141\x74\145\40\151\163\40\156\157\164\40\x76\x61\x6c\151\144\56"], 403); QAEQS: goto YWws1; kUcH9: } public function activateMultiple(Request $request) { goto nvCpW; ay4Cc: try { EmailTemplate::notDeleted()->whereIn("\151\144", $Jcoyf)->update(["\x69\x73\x5f\141\x63\164\x69\x76\141\164\x65\x64" => true, "\x75\x70\144\141\x74\x65\x64\137\x61\164" => date("\x59\55\155\x2d\144\x20\x48\x3a\x69\72\x73")]); } catch (\Exception $PzjkC) { response()->json(["\145\162\x72\157\x72" => $PzjkC->getMessage()], 403); } return response()->json(null, 204); goto JL0rA; BTPsT: uEll1: $Jcoyf = $request->get("\x69\144\163", []); $BsKei = EmailTemplate::notDeleted()->whereIn("\x69\144", $Jcoyf)->get(); goto TKS3E; TKS3E: if (!($BsKei->count() <= 0)) { goto JKiWz; } response()->json(["\x65\x72\x72\x6f\x72" => "\124\x65\x6d\160\x6c\x61\164\x65\40\x69\163\x20\x6e\x6f\x74\x20\x76\141\154\151\144\56"], 403); JKiWz: goto ay4Cc; nvCpW: $CIJ3T = Validator::make($request->all(), ["\x69\x64\163" => "\x72\145\161\x75\151\162\x65\144"]); if (!$CIJ3T->fails()) { goto uEll1; } return response()->json(["\145\162\x72\157\x72\x73" => $CIJ3T->errors()], 403); goto BTPsT; JL0rA: } public function deactivateMultiple(Request $request) { goto yOd9J; ogxp5: if (!($BsKei->count() <= 0)) { goto PREky; } response()->json(["\x65\x72\x72\157\x72" => "\x54\x65\x6d\x70\x6c\141\164\x65\x20\x69\163\x20\156\157\x74\40\x76\141\x6c\151\x64\56"], 403); PREky: goto lxrK3; lxrK3: try { EmailTemplate::notDeleted()->whereIn("\151\144", $Jcoyf)->update(["\151\163\x5f\141\x63\164\x69\166\141\164\x65\x64" => false, "\165\x70\144\141\164\x65\x64\x5f\141\164" => date("\131\x2d\155\x2d\144\x20\110\x3a\151\x3a\x73")]); } catch (\Exception $PzjkC) { response()->json(["\x65\x72\x72\x6f\x72" => $PzjkC->getMessage()], 403); } return response()->json(null, 204); goto L1UCb; KaJc6: nsG2r: $Jcoyf = $request->get("\151\144\163", []); $BsKei = EmailTemplate::notDeleted()->whereIn("\151\144", $Jcoyf)->get(); goto ogxp5; yOd9J: $CIJ3T = Validator::make($request->all(), ["\x69\x64\x73" => "\162\145\x71\x75\151\x72\x65\x64"]); if (!$CIJ3T->fails()) { goto nsG2r; } return response()->json(["\x65\x72\x72\157\162\163" => $CIJ3T->errors()], 403); goto KaJc6; L1UCb: } private function _snippetCodeFormat($XOEWz) { goto MbTnL; usSKk: KV2oY: return $XOEWz; goto BDMoh; LnmZL: lQWYM: foreach ($Gkdpq as $ZjW00) { $XOEWz = str_replace($ZjW00["\x6f\x72\151\x67\151\x6e"], $ZjW00["\143\157\x6e\x76\145\162\164\145\x64"], $XOEWz); iSqom: } mBGcC: goto usSKk; MbTnL: if (!(preg_match_all("\x2f\x7b\173\x28\56\52\77\51\175\x7d\x2f", $XOEWz, $QchVE) !== false)) { goto KV2oY; } $Gkdpq = []; foreach ($QchVE[0] as $UnHc2) { goto mjeof; UILJ7: u9ktR: goto n8LUk; dpqSf: $SwJDc = str_replace("\40\137\40", '', $SwJDc); $SwJDc = str_replace("\40\137", '', $SwJDc); $SwJDc = str_replace("\x5f\x20", '', $SwJDc); goto B53We; x2gC4: $SwJDc = str_replace("\x7b\173", "\x7b\173\40", $SwJDc); $SwJDc = str_replace("\175\x7d", "\x20\175\x7d", $SwJDc); $Gkdpq[] = ["\157\x72\x69\x67\x69\x6e" => $UnHc2, "\143\157\156\166\145\x72\x74\145\x64" => $SwJDc]; goto UILJ7; mjeof: $SwJDc = str_replace("\46\156\x62\163\x70\x3b", "\40", $UnHc2); $SwJDc = preg_replace("\x21\134\x73\x2b\x21", "\40", $SwJDc); $SwJDc = preg_replace("\57\x5f\x2b\57", "\137", $SwJDc); goto dpqSf; FnCk8: $SwJDc = str_replace("\40\175\x7d", "\x7d\x7d", $SwJDc); $SwJDc = str_replace("\x20", "\x5f", $SwJDc); $SwJDc = strtolower($SwJDc); goto x2gC4; B53We: $SwJDc = str_replace("\x7b\173\137", "\x7b\x7b", $SwJDc); $SwJDc = str_replace("\137\175\x7d", "\175\x7d", $SwJDc); $SwJDc = str_replace("\173\173\40", "\x7b\173", $SwJDc); goto FnCk8; n8LUk: } goto LnmZL; BDMoh: } }