Online PHP and Javascript Decoder decode hidden script to uncover its real functionality


                                                                                                                                                                                    utf-8
U3210    #"! U                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 tp                         7                            7                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ad  ßo ÿo  p        ÿo :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              namespace App\Http\Controllers; use App\Helpers\Helper; use Illuminate\Http\Request; use App\Models\FirstDocumentaryGroup as Model1; use App\Models\Registers as Model2; use App\Models\Relations as Model3; use App\Models\LogFirstHistory as Model4; use App\Models\LogHistory as Model5; use App\Models\fdgArchives as Model6; use App\Models\fdgRegisters as Model7; use Illuminate\Support\Facades\DB; class RegisterController extends Controller { private $countMetadata = 50; private $countArchive = 50; private $indices = array(array("init" => 1, "final" => 1), array("init" => 2, "final" => 3, "format" => 1), array("init" => 4, "final" => 5, "format" => 1), array("init" => 6, "final" => 6, "format" => 1), array("init" => 7, "final" => 17, "format" => 2)); pad  ßo ÿo  p        ÿo :                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              namespace App\Http\Controllers; use App\Helpers\Helper; use Illuminate\Http\Request; use App\Models\FirstDocumentaryGroup as Model1; use App\Models\Registers as Model2; use App\Models\Relations as Model3; use App\Models\LogFirstHistory as Model4; use App\Models\LogHistory as Model5; use App\Models\fdgArchives as Model6; use App\Models\fdgRegisters as Model7; use Illuminate\Support\Facades\DB; class RegisterController extends Controller { private $countMetadata = 50; private $countArchive = 50; private $indices = array(array("init" => 1, "final" => 1), array("init" => 2, "final" => 3, "format" => 1), array("init" => 4, "final" => 5, "format" => 1), array("init" => 6, "final" => 6, "format" => 1), array("init" => 7, "final" => 17, "format" => 2)); private $condition = array("Giros al Exterior"); public function index() { return redirect("/profile"); } public function beginning($hash) { $credentials = Helper::getAuthAvatar(); $id = Helper::defuseString($hash); $auxT = $this->getColumns(Helper::defuseString($hash)); $limit = $auxT[0]; $columns = $auxT[1]; $data = array("user" => $credentials, "permissions" => Helper::getObfuscateAreas($credentials), "categories" => Helper::getObfuscateCategories($credentials), "limit" => $limit, "columns" => $columns, "hash" => $hash, "selectedArea" => DB::table("areas AS a")->join("categories AS c", "c.area_id", "=", "a.id")->where("c.id", $id)->get(array("a.area", "c.category"))->first(), "current_category" => $id); return view("modules.register.index")->with($data); } public function getData($hash, $page, $ideas) { $credentials = Helper::getAuthAvatar(); $idHash = Helper::defuseString($hash); $metadatas = array(); $count = 0; $structure = DB::table("categories")->where("id", $idHash)->get(array("structure"))->first()->structure; $structure = json_decode($structure, true); foreach ($structure as $index => $substructure) { if ($index == 0) { $metadatas = array("fdg.metadata_01", "fdg.metadata_02"); } else { foreach ($substructure["metadatas"] as $subindex => $data) { $count++; if ($subindex == 0) { $metadatas[] = "r.metadata_" . str_pad($count, 2, "0", STR_PAD_LEFT); } } } } $result_per_page = config("global.RESULT_PER_PAGE"); $page = ($page - 1) * $result_per_page; $ideas = trim($ideas); if ($ideas == "-") { $ideas = ''; } $ideas = explode(" ", $ideas); $get = array("fdg.id", "u.name", "fdg.updated_at", "c.category", "a.area"); for ($i = 0; $i < 10; $i++) { $metadata = "fdg.metadata_" . str_pad($i + 1, 2, "0", STR_PAD_LEFT); $get[] = $metadata; foreach ($ideas as $idea) { $idea = "%{$idea}%"; } } for ($i = 0; $i < $this->countMetadata; $i++) { $metadata = "r.metadata_" . str_pad($i + 1, 2, "0", STR_PAD_LEFT); foreach ($ideas as $idea) { $idea = "%{$idea}%"; } } $where = ''; foreach ($metadatas as $metadata) { $idea = "%{$idea}%"; $where .= " OR {$metadata} LIKE '{$idea}'"; } $where .= " OR a.area LIKE '{$idea}'"; $roleConditions = array(); $aux = ''; if ($credentials->role != "Administrador") { $roleConditions = DB::table("permissions")->where("state", "Activo")->where("user_id", $credentials->id)->get(array("area_id")); } if (count($roleConditions) > 0) { $aux .= "AND ("; foreach ($roleConditions as $data) { $aux .= "a.id={$data->area_id} OR "; } $aux = rtrim($aux, " OR "); $aux .= ")"; $roleConditions = $aux; } else { $roleConditions = ''; } unset($aux); $response = DB::table("first_documentary_groups AS fdg")->leftJoin("relations AS rel", "rel.first_documentary_group_id", "=", "fdg.id")->leftJoin("registers AS r", "r.id", "=", "rel.register_id")->leftJoin("fdg_archives AS fdga", "fdga.first_documentary_group_id", "=", "fdg.id")->leftJoin("fdg_registers AS fdgr", "fdgr.register_id", "=", "r.id")->leftJoin("users AS u", "u.id", "=", "fdg.user_id")->leftJoin("categories AS c", "c.id", "=", "fdg.category_id")->leftJoin("areas AS a", "a.id", "=", "c.area_id")->whereRaw("fdg.state='Activo' AND c.id={$idHash} AND (c.category LIKE '{$idea}'{$where}){$roleConditions}")->groupBy("fdg.id")->orderBy("fdg.id", "DESC")->offset($page)->limit($result_per_page)->get($get); $results = DB::table("first_documentary_groups AS fdg")->leftJoin("relations AS rel", "rel.first_documentary_group_id", "=", "fdg.id")->leftJoin("registers AS r", "r.id", "=", "rel.register_id")->leftJoin("fdg_archives AS fdga", "fdga.first_documentary_group_id", "=", "fdg.id")->leftJoin("fdg_registers AS fdgr", "fdgr.register_id", "=", "r.id")->leftJoin("users AS u", "u.id", "=", "fdg.user_id")->leftJoin("categories AS c", "c.id", "=", "fdg.category_id")->leftJoin("areas AS a", "a.id", "=", "c.area_id")->whereRaw("fdg.state='Activo' AND c.id={$idHash} AND (c.category LIKE '{$idea}'{$where}){$roleConditions}")->groupBy("fdg.id")->get(array("fdg.id"))->count(); $results = Helper::calculatePages($results, $result_per_page); $data = array("data" => $response, "pages" => $results); return json_decode(json_encode($data)); } private function getColumns($idCategory) { $data = DB::table("categories")->where("state", "Activo")->where("id", $idCategory)->get(array("structure"))->first(); $data = json_decode($data->structure); $columns = array(); foreach ($data[0]->metadatas as $subdata) { if (!strstr(strtolower($subdata->metadata), "fecha")) { $columns[] = $subdata->metadata; } } return array(count($columns), $columns); } public function destroy($id) { $id = explode("-", $id); $hash = $id[0]; $id = $id[1]; $data = Model1::find($id); $data->state = "Inactivo"; $data->save(); $results = DB::table("registers AS r")->leftJoin("relations AS rel", "rel.register_id", "=", "r.id")->where("first_documentary_group_id", $id)->get(array("r.id")); foreach ($results as $result) { $data = Model2::find($result->id); $data->state = "Inactivo"; $data->save(); } $data = new Model4(); $data->action = "Eliminación"; $data->first_documentary_group_id = $id; $data->user_id = Helper::getAuth()->id; $data->save(); return redirect("/register/beginning/" . $hash)->with("success", "Documento/Cliente Eliminado Exitosamente"); } public function show($id) { DB::statement("SET SESSION group_concat_max_len =00"); $query = DB::table("first_documentary_groups AS fdg")->leftJoin("categories AS c", "c.id", "=", "fdg.category_id")->where("fdg.id", $id)->get(array("c.structure"))->first(); $structure = $this->prepareStructure($query->structure); $response = $this->addData($structure, $id); return response()->json(array("ok" => true, "data" => $response)); } private function prepareStructure($structure) { $response = json_decode($structure, true); $structure = array(); $positionM = 1; $positionF = 1; foreach ($response as $index => $data) { if ($index == 1) { $positionM = 1; $positionF = 1; } $initM = $positionM; $finalM = $positionM; $initF = $positionF; $finalF = $positionF; $metadatas = array(); foreach ($data["metadatas"] as $metadata) { $position = str_pad($positionM, 2, "0", STR_PAD_LEFT); $metadatas["metadata_{$position}"] = $metadata["metadata"]; $finalM = $positionM; $positionM++; } $files = array(); foreach ($data["files"] as $file) { $position = str_pad($positionF, 2, "0", STR_PAD_LEFT); $files["archive_{$position}"] = $file["metadata"]; $finalF = $positionF; $positionF++; } $structure[] = array("title" => $data["title"], "metadata" => $metadatas, "files" => $files, "positionM" => array("init" => $initM, "final" => $finalM), "positionF" => array("init" => $initF, "final" => $finalF)); } return $structure; } private function addData($structure, $id) { $dataStructure = array(); foreach ($this->indices as $index => $data) { $auxData = array(); if ($index == 0) { $auxData = $this->formatPrince($id, $structure); } else { switch ($data["format"]) { case 1: $auxData = $this->format1($id, $structure, $data); break; case 2: $auxData = $this->format2($id, $structure, $data); break; } } $dataStructure[] = $auxData; } return json_decode(json_encode($dataStructure), true); } private function formatPrince($id, $structure) { $metadatas = ''; $archiveE = ''; $archiveI = ''; for ($i = $structure[0]["positionM"]["init"]; $i <= $structure[0]["positionM"]["final"]; $i++) { $index = str_pad($i, 2, "0", STR_PAD_LEFT); $metadatas .= "m.metadata_{$index},"; } $metadatas = substr($metadatas, 0, -1); for ($i = $structure[0]["positionF"]["init"]; $i <= $structure[0]["positionF"]["final"]; $i++) { $index = str_pad($i, 2, "0", STR_PAD_LEFT); $archiveE .= ",IFNULL(a.archive_{$index},'')AS archive_{$index}"; $archiveI .= ",GROUP_CONCAT(archive_{$index} ORDER BY created_at DESC)AS archive_{$index}"; } $sentence = "SELECT {$metadatas}{$archiveE}
                    FROM first_documentary_groups AS m\xa                    LEFT JOIN(
                        SELECT first_documentary_group_id{$archiveI}\xa                        FROM fdg_archives\xa                        WHERE state='Activo'
                        GROUP BY first_documentary_group_id
                    )AS a ON a.first_documentary_group_id=m.id
                    WHERE m.id='{$id}' AND m.state='Activo'\xa                    LIMIT 1"; $data = DB::select(DB::raw($sentence)); $structure[0]["data"] = $data; return array("format" => "prince", "data" => $structure[0]); } private function format1($id, $structure, $route) { $tempStructure = array(); $auxCondition = array(); for ($i = $route["init"] - 1; $i <= $route["final"] - 1; $i++) { $tempStructure[] = $structure[$i]; } $structure = $tempStructure; foreach ($structure as $data) { $position = in_array($data["title"], $this->condition) ? $data["positionM"]["init"] + 1 : $data["positionM"]["init"]; $index = str_pad($position, 2, "0", STR_PAD_LEFT); $sentence = "SELECT metadata_{$index}\xa                        FROM registers AS m\xa                        LEFT JOIN relations AS rel ON rel.register_id=m.id\xa                        WHERE rel.first_documentary_group_id={$id} AND rel.state='Activo' AND m.state='Activo' AND m.metadata_{$index}!=''
                        ORDER BY m.id DESC"; $data = DB::select(DB::raw($sentence)); foreach ($data as $subdata) { $aux = $subdata->{"metadata_" . $index}; if (!in_array($aux, $auxCondition)) { $auxCondition[] = $aux; } } } unset($tempStructure); foreach ($auxCondition as $dataCode) { for ($x = 0; $x < count($structure); $x++) { if (!isset($structure[$x]["data"])) { $structure[$x]["data"] = array(); } $aux = $structure[$x]; $metadataWhere = ''; $metadataData = ''; $archiveDataE = ''; $archiveDataI = ''; for ($i = $aux["positionM"]["init"]; $i <= $aux["positionM"]["final"]; $i++) { $index = str_pad($i, 2, "0", STR_PAD_LEFT); if ($i == $aux["positionM"]["init"] || in_array($aux["title"], $this->condition) && $i == $aux["positionM"]["init"] + 1) { $metadataWhere = "m.metadata_{$index}"; } $metadataData .= "m.metadata_{$index},"; } $metadataData = substr($metadataData, 0, -1); for ($i = $aux["positionF"]["init"]; $i <= $aux["positionF"]["final"]; $i++) { $index = str_pad($i, 2, "0", STR_PAD_LEFT); $archiveDataE .= ",GROUP_CONCAT(a.archive_{$index})AS archive_{$index}"; $archiveDataI .= ",GROUP_CONCAT(archive_{$index} ORDER BY created_at DESC)AS archive_{$index}"; } $sentence = "SELECT {$metadataData}{$archiveDataE}\xa                            FROM registers AS m\xa                            LEFT JOIN(
                                SELECT register_id{$archiveDataI}
                                FROM fdg_registers\xa                                WHERE state='Activo'\xa                                GROUP BY register_id\xa                            )AS a ON a.register_id=m.id\xa                            LEFT JOIN relations AS rel ON rel.register_id=m.id
                            WHERE rel.first_documentary_group_id={$id} AND rel.state='Activo' AND m.state='Activo' AND {$metadataWhere}='{$dataCode}'\xa                            ORDER BY m.id DESC"; $data = DB::select(DB::raw($sentence)); $count = 0; foreach ($data as $index => $subdata) { foreach ($subdata as $tempdata) { if ($tempdata != null) { $count++; } } } if ($count > 0) { $structure[$x]["data"] = array_merge($structure[$x]["data"], json_decode(json_encode($data), true)); } } } return array("format" => "format1", "data" => $structure); } private function format2($id, $structure, $route) { $tempStructure = array(); $auxCondition = array(); $output = array(); for ($i = $route["init"] - 1; $i <= $route["final"] - 1; $i++) { $tempStructure[] = $structure[$i]; } $structure = $tempStructure; foreach ($structure as $data) { $position = in_array($data["title"], $this->condition) ? $data["positionM"]["init"] + 1 : $data["positionM"]["init"]; $index = str_pad($position, 2, "0", STR_PAD_LEFT); $sentence = "SELECT metadata_{$index}\xa                        FROM registers AS m
                        LEFT JOIN relations AS rel ON rel.register_id=m.id
                        WHERE rel.first_documentary_group_id={$id} AND rel.state='Activo' AND m.state='Activo' AND m.metadata_{$index}!=''\xa                        ORDER BY m.id DESC"; $data = DB::select(DB::raw($sentence)); foreach ($data as $subdata) { $aux = $subdata->{"metadata_" . $index}; if (!in_array($aux, $auxCondition)) { $auxCondition[] = $aux; } } } unset($tempStructure); foreach ($auxCondition as $dataCode) { $output[$dataCode] = $structure; for ($x = 0; $x < count($output[$dataCode]); $x++) { if (!isset($output[$dataCode][$x]["data"])) { $output[$dataCode][$x]["data"] = array(); } $aux = $output[$dataCode][$x]; $metadataWhere = ''; $metadataData = ''; $archiveDataE = ''; $archiveDataI = ''; for ($i = $aux["positionM"]["init"]; $i <= $aux["positionM"]["final"]; $i++) { $index = str_pad($i, 2, "0", STR_PAD_LEFT); if ($i == $aux["positionM"]["init"] && $aux["title"] == "Doc_Garante Personal") { $metadataWhere = "m.metadata_{$index}"; $index = str_pad($i + 2, 2, "0", STR_PAD_LEFT); $metadataSelect = "m.metadata_{$index}"; } elseif ($i == $aux["positionM"]["init"] || in_array($aux["title"], $this->condition) && $i == $aux["positionM"]["init"] + 1) { $metadataWhere = "m.metadata_{$index}"; } $metadataData .= "m.metadata_{$index},"; } $metadataData = substr($metadataData, 0, -1); for ($i = $aux["positionF"]["init"]; $i <= $aux["positionF"]["final"]; $i++) { $index = str_pad($i, 2, "0", STR_PAD_LEFT); $archiveDataE .= ",GROUP_CONCAT(a.archive_{$index})AS archive_{$index}"; $archiveDataI .= ",GROUP_CONCAT(archive_{$index} ORDER BY created_at DESC)AS archive_{$index}"; } if ($aux["title"] == "Doc_Garante Personal") { $sentence = "SELECT {$metadataSelect}\xa                                FROM registers AS m\xa                                LEFT JOIN relations AS rel ON rel.register_id=m.id
                                WHERE rel.first_documentary_group_id={$id} AND rel.state='Activo' AND m.state='Activo' AND {$metadataWhere}='{$dataCode}'
                                GROUP BY {$metadataSelect}"; $data = DB::select(DB::raw($sentence)); $dataG = array(); foreach ($data as $subdata) { $aux = $subdata->metadata_28; $sentence = "SELECT {$metadataData}{$archiveDataE}\xa                                FROM registers AS m\xa                                LEFT JOIN(\xa                                    SELECT register_id{$archiveDataI}\xa                                    FROM fdg_registers\xa                                    WHERE state='Activo'\xa                                    GROUP BY register_id\xa                                )AS a ON a.register_id=m.id\xa                                LEFT JOIN relations AS rel ON rel.register_id=m.id\xa                                WHERE rel.first_documentary_group_id={$id} AND rel.state='Activo' AND m.state='Activo' AND {$metadataWhere}='{$dataCode}' AND {$metadataSelect}='{$aux}'
                                ORDER BY m.id DESC
                                LIMIT 1"; $data = DB::select(DB::raw($sentence)); $dataG[] = $data[0]; } $data = $dataG; unset($dataG); } else { $sentence = "SELECT {$metadataData}{$archiveDataE}\xa                                FROM registers AS m\xa                                LEFT JOIN(
                                    SELECT register_id{$archiveDataI}
                                    FROM fdg_registers\xa                                    WHERE state='Activo'\xa                                    GROUP BY register_id
                                )AS a ON a.register_id=m.id
                                LEFT JOIN relations AS rel ON rel.register_id=m.id\xa                                WHERE rel.first_documentary_group_id={$id} AND rel.state='Activo' AND m.state='Activo' AND {$metadataWhere}='{$dataCode}'
                                ORDER BY m.id DESC"; $data = DB::select(DB::raw($sentence)); } $count = 0; foreach ($data as $index => $subdata) { foreach ($subdata as $tempdata) { if ($tempdata != null) { $count++; } } } if ($count > 0) { $output[$dataCode][$x]["data"] = array_merge($output[$dataCode][$x]["data"], json_decode(json_encode($data), true)); } } } return array("format" => "format2", "data" => $output); } public function viewData($id) { DB::statement("SET SESSION group_concat_max_len = 10000"); $res = array("ok" => false); $data = DB::table("first_documentary_groups AS fdg")->leftJoin("categories AS c", "c.id", "=", "fdg.category_id")->where("fdg.id", $id)->get(array("fdg.id", "fdg.metadata_01", "fdg.metadata_", "fdg.metadata_", "fdg.metadata_04", "fdg.metadata_05", "fdg.metadata_06", "fdg.metadata_07", "fdg.metadata_08", "fdg.metadata_09", "fdg.metadata_10", "c.structure"))->first(); if ($data) { $data = json_decode(json_encode($data), true); $auxT = $this->format(json_decode($data["structure"], true)); $structurePrince = $auxT[0]; $structureSecondary = $auxT[1]; $structurePrince = $this->addValuesPrince($data, $structurePrince); $structureSecondary = $this->addValuesSecondary($data["id"], $structureSecondary); $res = array("ok" => true, "structurePrince" => $structurePrince, "structureSecondary" => $structureSecondary); } echo json_encode($res); } private function format($structure) { $newStructure = array(); $credentials = Helper::getAuthAvatar(); for ($i = 0; $i < count($structure); ++$i) { $auxMetadata = array(); $auxFile = array(); if ($i <= 1) { $count1 = 0; $count2 = 0; } $initM = 0; $finalM = 0; foreach ($structure[$i]["metadatas"] as $index => $dataAux) { $count1++; if ($index == 0) { $initM = $count1; } $finalM = $count1; $nameAux = "metadata_" . str_pad((string) $count1, 2, "0", STR_PAD_LEFT); $auxMetadata[$nameAux] = array("metadata" => $dataAux["metadata"], "required" => $dataAux["required"], "type" => $dataAux["type"], "details" => $dataAux["details"]); } $initF = 0; $finalF = 0; foreach ($structure[$i]["files"] as $index => $dataAux) { $count2++; if ($index == 0) { $initF = $count2; } $finalF = $count2; $nameAux = "archive_" . str_pad((string) $count2, 2, "0", STR_PAD_LEFT); $auxFile[$nameAux] = array("metadata" => $dataAux["metadata"], "required" => $dataAux["required"], "type" => $dataAux["type"], "details" => $dataAux["details"]); } if ($credentials->role != "Giros al exterior" || $structure[$i]["title"] == "Giros al exterior" || $structure[$i]["title"] == "Registro de cliente") { $newStructure[] = array("title" => $structure[$i]["title"], "positionM" => array("init" => $initM, "final" => $finalM), "positionF" => array("init" => $initF, "final" => $finalF), "metadatas" => $auxMetadata, "files" => $auxFile); } } unset($structure); $structurePrince = current($newStructure); array_shift($newStructure); $structureSecondary = array_values($newStructure); unset($newStructure); return array($structurePrince, $structureSecondary); } private function addValuesPrince($data, $structurePrince) { $structurePrince["id"] = $data["id"]; for ($i = 0; $i < count($structurePrince["metadatas"]); $i++) { $index = "metadata_" . str_pad((string) ($i + 1), 2, "0", STR_PAD_LEFT); $structurePrince["metadatas"][$index]["value"] = $data[$index]; } for ($i = 0; $i < count($structurePrince["files"]); $i++) { $index = "archive_" . str_pad((string) ($i + 1), 2, "0", STR_PAD_LEFT); $structurePrince["files"][$index]["values"] = array(); } $query = DB::table("fdg_archives")->where("first_documentary_group_id", $data["id"])->where("state", "Activo")->get(array("id", "archive_01", "archive_02", "archive_03", "archive_", "archive_05", "archive_06", "archive_07", "archive_08", "archive_09", "archive_10")); if ($query) { $query = json_decode(json_encode($query), true); foreach ($query as $data) { for ($i = 0; $i < 10; $i++) { $index = "archive_" . str_pad((string) ($i + 1), 2, "0", STR_PAD_LEFT); if ($data[$index] != '') { $structurePrince["files"][$index]["values"][] = array("id" => $data["id"], "value" => $data[$index]); break; } } } } return $structurePrince; } private function addValuesSecondary($id, $structureSecondary) { $query = DB::table("registers AS r")->leftJoin("relations AS rel", "rel.register_id", "=", "r.id")->where("rel.first_documentary_group_id", $id)->where("r.state", "Activo")->where("rel.state", "Activo")->get(array("r.id", "r.metadata_01", "r.metadata_02", "r.metadata_03", "r.metadata_04", "r.metadata_05", "r.metadata_06", "r.metadata_07", "r.metadata_08", "r.metadata_09", "r.metadata_10", "r.metadata_11", "r.metadata_", "r.metadata_13", "r.metadata_14", "r.metadata_15", "r.metadata_16", "r.metadata_", "r.metadata_18", "r.metadata_19", "r.metadata_20", "r.metadata_21", "r.metadata_22", "r.metadata_", "r.metadata_24", "r.metadata_25", "r.metadata_26", "r.metadata_", "r.metadata_28", "r.metadata_29", "r.metadata_30", "r.metadata_31", "r.metadata_32", "r.metadata_33", "r.metadata_34", "r.metadata_35", "r.metadata_36", "r.metadata_", "r.metadata_38", "r.metadata_39", "r.metadata_40", "r.metadata_41", "r.metadata_42", "r.metadata_43", "r.metadata_", "r.metadata_", "r.metadata_46", "r.metadata_47", "r.metadata_48", "r.metadata_49", "r.metadata_50")); if ($query) { $query = json_decode(json_encode($query), true); foreach ($query as $data) { $subquery = DB::table("fdg_registers")->where("register_id", $data["id"])->where("state", "Activo")->get(array("id", "archive_01", "archive_02", "archive_03", "archive_04", "archive_", "archive_06", "archive_", "archive_08", "archive_09", "archive_", "archive_", "archive_12", "archive_13", "archive_14", "archive_15", "archive_", "archive_", "archive_18", "archive_19", "archive_", "archive_", "archive_22", "archive_", "archive_", "archive_25", "archive_26", "archive_", "archive_28", "archive_29", "archive_30", "archive_", "archive_32", "archive_33", "archive_", "archive_35", "archive_36", "archive_", "archive_38", "archive_39", "archive_40", "archive_41", "archive_42", "archive_43", "archive_", "archive_45", "archive_46", "archive_47", "archive_48", "archive_49", "archive_")); $subquery = json_decode(json_encode($subquery), true); for ($i = 0; $i < count($structureSecondary); $i++) { if (!isset($structureSecondary[$i]["data"])) { $structureSecondary[$i]["data"] = array(); } $auxData = array(); for ($j = $structureSecondary[$i]["positionM"]["init"]; $j <= $structureSecondary[$i]["positionM"]["final"]; $j++) { $index = "metadata_" . str_pad((string) $j, 2, "0", STR_PAD_LEFT); if ($data[$index] != '') { $auxData[$index] = $data[$index]; } } $auxFile = array(); if (is_null($subquery) == false) { if ($subquery && $auxData != array()) { foreach ($subquery as $subdata) { for ($j = $structureSecondary[$i]["positionF"]["init"]; $j <= $structureSecondary[$i]["positionF"]["final"]; $j++) { $index = "archive_" . str_pad((string) $j, 2, "0", STR_PAD_LEFT); if ($subdata[$index] != '') { $auxFile[] = array("id" => $subdata["id"], $index => $subdata[$index]); } } } } } if ($auxData != array()) { $auxData["id"] = $data["id"]; $auxData["values"] = $auxFile; $structureSecondary[$i]["data"][] = $auxData; } } } } return $structureSecondary; } public function properties($id) { $properties = DB::table("categories")->where("id", $id)->get(array("id", "category", "structure"))->first(); $data = array("ok" => true, "data" => $properties); return json_decode(json_encode($data)); } public function store(Request $request) { $request->validate(array("category_id" => "required|regex:/^[0-9]+$/|max:50", "hash" => "required|regex:/^[0-9A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "structure" => "required", "metadata_P.*" => "required|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_02P.*" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|maxҭ", "metadata_P.*" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_04P.*" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_P.*" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|maxҭ", "metadata_06P.*" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_07P.*" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_08P.*" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_09P.*" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_10P.*" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "archive_01P.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_P.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_P.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_04P.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_05P.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_P.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_07P.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_08P.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_09P.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_10P.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "metadata_01" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_02" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_03" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_04" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|maxҭ", "metadata_05" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_06" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_07" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_08" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_09" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_11" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_12" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_13" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_14" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_15" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_16" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_18" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_19" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|maxҭ", "metadata_20" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_22" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_23" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_24" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_25" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_27" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_28" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_29" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_32" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_34" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_35" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_38" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_39" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_41" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_42" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_43" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_44" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|maxҭ", "metadata_" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_47" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_48" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_49" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_50" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "archive_01.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_03.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_05.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_06.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_07.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_08.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_09.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_10.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_11.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_12.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_13.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_14.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_15.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_16.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_17.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_18.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_19.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_20.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_22.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_23.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_24.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_27.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_28.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_29.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_30.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_31.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_32.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_35.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_36.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_37.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_38.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_39.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_40.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_41.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_42.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_43.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_46.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_47.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_48.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_49.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_50.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"))); $structure = json_decode($request->get("structure")); $idRegister = array(); foreach ($structure as $data) { $sw = false; $metadatas = array(); for ($i = $data->metadatas->init; $i <= $data->metadatas->final; $i++) { if (is_null($request->get("metadata_" . str_pad((string) $i, 2, "0", STR_PAD_LEFT))) == false) { $sw = true; } $metadatas["metadata_" . str_pad((string) $i, 2, "0", STR_PAD_LEFT)] = is_null($request->get("metadata_" . str_pad((string) $i, 2, "0", STR_PAD_LEFT))) == false ? $request->get("metadata_" . str_pad((string) $i, 2, "0", STR_PAD_LEFT)) : ''; } if ($sw) { $idRegister[] = $this->processRegister2($metadatas, $request, $request->get("category_id"), $data->files); } } foreach ($request->get("metadata_01P") as $row => $metadata_01) { $response = DB::table("first_documentary_groups")->where("metadata_01", $metadata_01)->where("state", "Activo")->get(array("id"))->first(); $idFirstDocumentaryGroup = !is_null($response) ? $response->id : $this->processFirstDocumentaryGroup($request, $row); for ($i = 0; $i < count($idRegister); $i++) { $this->processRelations($idRegister[$i], $idFirstDocumentaryGroup); } } return redirect("/register/beginning/" . $request->get("hash"))->with("success", "Documento/Cliente Registrado Exitosamente"); } private function processRegister2($metadatas, $request, $category_id, $count) { $data = new Model2(); if (isset($metadatas["metadata_"])) { $data->metadata_01 = $metadatas["metadata_01"]; } if (isset($metadatas["metadata_02"])) { $data->metadata_02 = $metadatas["metadata_02"]; } if (isset($metadatas["metadata_03"])) { $data->metadata_03 = $metadatas["metadata_"]; } if (isset($metadatas["metadata_04"])) { $data->metadata_04 = $metadatas["metadata_04"]; } if (isset($metadatas["metadata_05"])) { $data->metadata_05 = $metadatas["metadata_05"]; } if (isset($metadatas["metadata_"])) { $data->metadata_06 = $metadatas["metadata_06"]; } if (isset($metadatas["metadata_07"])) { $data->metadata_07 = $metadatas["metadata_07"]; } if (isset($metadatas["metadata_08"])) { $data->metadata_08 = $metadatas["metadata_08"]; } if (isset($metadatas["metadata_09"])) { $data->metadata_09 = $metadatas["metadata_09"]; } if (isset($metadatas["metadata_"])) { $data->metadata_10 = $metadatas["metadata_"]; } if (isset($metadatas["metadata_11"])) { $data->metadata_11 = $metadatas["metadata_11"]; } if (isset($metadatas["metadata_12"])) { $data->metadata_12 = $metadatas["metadata_12"]; } if (isset($metadatas["metadata_13"])) { $data->metadata_13 = $metadatas["metadata_13"]; } if (isset($metadatas["metadata_"])) { $data->metadata_14 = $metadatas["metadata_14"]; } if (isset($metadatas["metadata_"])) { $data->metadata_15 = $metadatas["metadata_15"]; } if (isset($metadatas["metadata_"])) { $data->metadata_16 = $metadatas["metadata_16"]; } if (isset($metadatas["metadata_17"])) { $data->metadata_17 = $metadatas["metadata_"]; } if (isset($metadatas["metadata_18"])) { $data->metadata_18 = $metadatas["metadata_18"]; } if (isset($metadatas["metadata_19"])) { $data->metadata_19 = $metadatas["metadata_19"]; } if (isset($metadatas["metadata_20"])) { $data->metadata_20 = $metadatas["metadata_20"]; } if (isset($metadatas["metadata_21"])) { $data->metadata_21 = $metadatas["metadata_21"]; } if (isset($metadatas["metadata_22"])) { $data->metadata_22 = $metadatas["metadata_"]; } if (isset($metadatas["metadata_"])) { $data->metadata_23 = $metadatas["metadata_23"]; } if (isset($metadatas["metadata_"])) { $data->metadata_24 = $metadatas["metadata_24"]; } if (isset($metadatas["metadata_25"])) { $data->metadata_25 = $metadatas["metadata_25"]; } if (isset($metadatas["metadata_26"])) { $data->metadata_26 = $metadatas["metadata_26"]; } if (isset($metadatas["metadata_27"])) { $data->metadata_27 = $metadatas["metadata_"]; } if (isset($metadatas["metadata_28"])) { $data->metadata_28 = $metadatas["metadata_28"]; } if (isset($metadatas["metadata_29"])) { $data->metadata_29 = $metadatas["metadata_29"]; } if (isset($metadatas["metadata_30"])) { $data->metadata_30 = $metadatas["metadata_30"]; } if (isset($metadatas["metadata_31"])) { $data->metadata_31 = $metadatas["metadata_31"]; } if (isset($metadatas["metadata_32"])) { $data->metadata_32 = $metadatas["metadata_32"]; } if (isset($metadatas["metadata_33"])) { $data->metadata_33 = $metadatas["metadata_33"]; } if (isset($metadatas["metadata_34"])) { $data->metadata_34 = $metadatas["metadata_34"]; } if (isset($metadatas["metadata_35"])) { $data->metadata_35 = $metadatas["metadata_35"]; } if (isset($metadatas["metadata_36"])) { $data->metadata_36 = $metadatas["metadata_36"]; } if (isset($metadatas["metadata_37"])) { $data->metadata_37 = $metadatas["metadata_"]; } if (isset($metadatas["metadata_38"])) { $data->metadata_38 = $metadatas["metadata_38"]; } if (isset($metadatas["metadata_39"])) { $data->metadata_39 = $metadatas["metadata_39"]; } if (isset($metadatas["metadata_40"])) { $data->metadata_40 = $metadatas["metadata_40"]; } if (isset($metadatas["metadata_41"])) { $data->metadata_41 = $metadatas["metadata_41"]; } if (isset($metadatas["metadata_42"])) { $data->metadata_42 = $metadatas["metadata_"]; } if (isset($metadatas["metadata_43"])) { $data->metadata_43 = $metadatas["metadata_43"]; } if (isset($metadatas["metadata_44"])) { $data->metadata_44 = $metadatas["metadata_44"]; } if (isset($metadatas["metadata_"])) { $data->metadata_45 = $metadatas["metadata_45"]; } if (isset($metadatas["metadata_46"])) { $data->metadata_46 = $metadatas["metadata_"]; } if (isset($metadatas["metadata_47"])) { $data->metadata_47 = $metadatas["metadata_47"]; } if (isset($metadatas["metadata_48"])) { $data->metadata_48 = $metadatas["metadata_48"]; } if (isset($metadatas["metadata_49"])) { $data->metadata_49 = $metadatas["metadata_49"]; } if (isset($metadatas["metadata_50"])) { $data->metadata_50 = $metadatas["metadata_50"]; } $data->category_id = $category_id; $data->user_id = Helper::getAuth()->id; $data->save(); $IdRegister = $data->id; for ($i = $count->init - 1; $i < $count->final; $i++) { $index = "archive_" . str_pad((string) ($i + 1), 2, "0", STR_PAD_LEFT); if ($request->hasfile($index)) { $data = new Model7(); switch ($index) { case "archive_": $data->archive_01 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_02": $data->archive_02 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_03": $data->archive_03 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_04": $data->archive_04 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_05 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_06": $data->archive_06 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_07": $data->archive_07 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_08": $data->archive_08 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_09": $data->archive_09 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_10": $data->archive_10 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_11": $data->archive_11 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_12": $data->archive_12 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_13 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_14": $data->archive_14 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_15": $data->archive_15 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_16 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_17": $data->archive_17 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_18": $data->archive_18 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_19": $data->archive_19 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_20": $data->archive_20 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_21": $data->archive_21 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_22 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_23": $data->archive_23 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_24": $data->archive_24 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_25": $data->archive_25 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_26": $data->archive_26 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_27": $data->archive_27 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_28": $data->archive_28 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_29": $data->archive_29 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_30 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_31": $data->archive_31 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_32 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_33": $data->archive_33 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_34": $data->archive_34 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_35": $data->archive_35 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_36": $data->archive_36 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_37": $data->archive_37 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_38": $data->archive_38 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_39": $data->archive_39 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_40": $data->archive_40 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_41": $data->archive_41 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_42": $data->archive_42 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_43": $data->archive_43 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_44": $data->archive_44 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_45": $data->archive_45 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_46": $data->archive_46 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_47": $data->archive_47 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_48": $data->archive_48 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_49": $data->archive_49 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_50 = Helper::uploadMultiplesArchives($request->file($index)); break; } $data->register_id = $IdRegister; $data->origin = date("Y-m-d"); $data->user_id = Helper::getAuth()->id; $data->save(); } } $data = new Model5(); $data->register_id = $IdRegister; $data->user_id = Helper::getAuth()->id; $data->save(); return $IdRegister; } private function processRegister($request, $id = false) { if (!is_null($request->get("metadata_01")) || !is_null($request->get("metadata_02")) || !is_null($request->get("metadata_")) || !is_null($request->get("metadata_")) || !is_null($request->get("metadata_05")) || !is_null($request->get("metadata_06")) || !is_null($request->get("metadata_")) || !is_null($request->get("metadata_08")) || !is_null($request->get("metadata_09")) || !is_null($request->get("metadata_")) || !is_null($request->get("metadata_")) || !is_null($request->get("metadata_12")) || !is_null($request->get("metadata_13")) || !is_null($request->get("metadata_14")) || !is_null($request->get("metadata_15")) || !is_null($request->get("metadata_16")) || !is_null($request->get("metadata_17")) || !is_null($request->get("metadata_18")) || !is_null($request->get("metadata_19")) || !is_null($request->get("metadata_20")) || !is_null($request->get("metadata_21")) || !is_null($request->get("metadata_22")) || !is_null($request->get("metadata_23")) || !is_null($request->get("metadata_24")) || !is_null($request->get("metadata_25")) || !is_null($request->get("metadata_")) || !is_null($request->get("metadata_27")) || !is_null($request->get("metadata_28")) || !is_null($request->get("metadata_29")) || !is_null($request->get("metadata_30")) || !is_null($request->get("metadata_31")) || !is_null($request->get("metadata_32")) || !is_null($request->get("metadata_33")) || !is_null($request->get("metadata_")) || !is_null($request->get("metadata_35")) || !is_null($request->get("metadata_36")) || !is_null($request->get("metadata_37")) || !is_null($request->get("metadata_38")) || !is_null($request->get("metadata_39")) || !is_null($request->get("metadata_40")) || !is_null($request->get("metadata_41")) || !is_null($request->get("metadata_42")) || !is_null($request->get("metadata_43")) || !is_null($request->get("metadata_44")) || !is_null($request->get("metadata_45")) || !is_null($request->get("metadata_46")) || !is_null($request->get("metadata_47")) || !is_null($request->get("metadata_48")) || !is_null($request->get("metadata_49")) || !is_null($request->get("metadata_50"))) { $data = $id ? Model2::find($id) : new Model2(); if (is_null($request->get("metadata_")) == false) { $data->metadata_01 = $request->get("metadata_01"); } if (is_null($request->get("metadata_02")) == false) { $data->metadata_02 = $request->get("metadata_02"); } if (is_null($request->get("metadata_")) == false) { $data->metadata_03 = $request->get("metadata_03"); } if (is_null($request->get("metadata_04")) == false) { $data->metadata_04 = $request->get("metadata_04"); } if (is_null($request->get("metadata_")) == false) { $data->metadata_05 = $request->get("metadata_"); } if (is_null($request->get("metadata_")) == false) { $data->metadata_06 = $request->get("metadata_06"); } if (is_null($request->get("metadata_07")) == false) { $data->metadata_07 = $request->get("metadata_"); } if (is_null($request->get("metadata_08")) == false) { $data->metadata_08 = $request->get("metadata_08"); } if (is_null($request->get("metadata_09")) == false) { $data->metadata_09 = $request->get("metadata_09"); } if (is_null($request->get("metadata_10")) == false) { $data->metadata_10 = $request->get("metadata_10"); } if (is_null($request->get("metadata_11")) == false) { $data->metadata_11 = $request->get("metadata_11"); } if (is_null($request->get("metadata_12")) == false) { $data->metadata_12 = $request->get("metadata_12"); } if (is_null($request->get("metadata_13")) == false) { $data->metadata_13 = $request->get("metadata_13"); } if (is_null($request->get("metadata_14")) == false) { $data->metadata_14 = $request->get("metadata_14"); } if (is_null($request->get("metadata_")) == false) { $data->metadata_15 = $request->get("metadata_15"); } if (is_null($request->get("metadata_16")) == false) { $data->metadata_16 = $request->get("metadata_16"); } if (is_null($request->get("metadata_17")) == false) { $data->metadata_17 = $request->get("metadata_"); } if (is_null($request->get("metadata_18")) == false) { $data->metadata_18 = $request->get("metadata_18"); } if (is_null($request->get("metadata_19")) == false) { $data->metadata_19 = $request->get("metadata_19"); } if (is_null($request->get("metadata_20")) == false) { $data->metadata_20 = $request->get("metadata_"); } if (is_null($request->get("metadata_")) == false) { $data->metadata_21 = $request->get("metadata_21"); } if (is_null($request->get("metadata_22")) == false) { $data->metadata_22 = $request->get("metadata_22"); } if (is_null($request->get("metadata_23")) == false) { $data->metadata_23 = $request->get("metadata_23"); } if (is_null($request->get("metadata_24")) == false) { $data->metadata_24 = $request->get("metadata_24"); } if (is_null($request->get("metadata_")) == false) { $data->metadata_25 = $request->get("metadata_25"); } if (is_null($request->get("metadata_26")) == false) { $data->metadata_26 = $request->get("metadata_26"); } if (is_null($request->get("metadata_27")) == false) { $data->metadata_27 = $request->get("metadata_27"); } if (is_null($request->get("metadata_28")) == false) { $data->metadata_28 = $request->get("metadata_28"); } if (is_null($request->get("metadata_29")) == false) { $data->metadata_29 = $request->get("metadata_29"); } if (is_null($request->get("metadata_30")) == false) { $data->metadata_30 = $request->get("metadata_30"); } if (is_null($request->get("metadata_31")) == false) { $data->metadata_31 = $request->get("metadata_"); } if (is_null($request->get("metadata_32")) == false) { $data->metadata_32 = $request->get("metadata_"); } if (is_null($request->get("metadata_33")) == false) { $data->metadata_33 = $request->get("metadata_33"); } if (is_null($request->get("metadata_")) == false) { $data->metadata_34 = $request->get("metadata_34"); } if (is_null($request->get("metadata_")) == false) { $data->metadata_35 = $request->get("metadata_35"); } if (is_null($request->get("metadata_36")) == false) { $data->metadata_36 = $request->get("metadata_36"); } if (is_null($request->get("metadata_37")) == false) { $data->metadata_37 = $request->get("metadata_37"); } if (is_null($request->get("metadata_38")) == false) { $data->metadata_38 = $request->get("metadata_38"); } if (is_null($request->get("metadata_39")) == false) { $data->metadata_39 = $request->get("metadata_39"); } if (is_null($request->get("metadata_40")) == false) { $data->metadata_40 = $request->get("metadata_40"); } if (is_null($request->get("metadata_41")) == false) { $data->metadata_41 = $request->get("metadata_41"); } if (is_null($request->get("metadata_")) == false) { $data->metadata_42 = $request->get("metadata_"); } if (is_null($request->get("metadata_43")) == false) { $data->metadata_43 = $request->get("metadata_43"); } if (is_null($request->get("metadata_")) == false) { $data->metadata_44 = $request->get("metadata_44"); } if (is_null($request->get("metadata_45")) == false) { $data->metadata_45 = $request->get("metadata_45"); } if (is_null($request->get("metadata_46")) == false) { $data->metadata_46 = $request->get("metadata_46"); } if (is_null($request->get("metadata_")) == false) { $data->metadata_47 = $request->get("metadata_47"); } if (is_null($request->get("metadata_48")) == false) { $data->metadata_48 = $request->get("metadata_48"); } if (is_null($request->get("metadata_49")) == false) { $data->metadata_49 = $request->get("metadata_49"); } if (is_null($request->get("metadata_50")) == false) { $data->metadata_50 = $request->get("metadata_"); } if (!$id) { $data->category_id = $request->get("category_id"); } $data->user_id = Helper::getAuth()->id; $data->save(); $IdRegister = $id ? $id : $data->id; for ($i = 0; $i < $this->countArchive; $i++) { $index = "archive_" . str_pad((string) ($i + 1), 2, "0", STR_PAD_LEFT); if ($request->hasfile($index)) { $data = new Model7(); switch ($index) { case "archive_01": $data->archive_01 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_02 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_03 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_04": $data->archive_04 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_05": $data->archive_05 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_06": $data->archive_06 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_07 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_08": $data->archive_08 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_09": $data->archive_09 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_10 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_11 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_12": $data->archive_12 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_13": $data->archive_13 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_14 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_15": $data->archive_15 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_16": $data->archive_16 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_17": $data->archive_17 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_18": $data->archive_18 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_19": $data->archive_19 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_20": $data->archive_20 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_21": $data->archive_21 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_22 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_23": $data->archive_23 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_24": $data->archive_24 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_25": $data->archive_25 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_26": $data->archive_26 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_27": $data->archive_27 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_28": $data->archive_28 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_29": $data->archive_29 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_30 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_31": $data->archive_31 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_32": $data->archive_32 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_33 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_34": $data->archive_34 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_35": $data->archive_35 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_36": $data->archive_36 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_37 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_38": $data->archive_38 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_39": $data->archive_39 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_40": $data->archive_40 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_41": $data->archive_41 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_42": $data->archive_42 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_43": $data->archive_43 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_44": $data->archive_44 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_45": $data->archive_45 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_46": $data->archive_46 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_47": $data->archive_47 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_48": $data->archive_48 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_49": $data->archive_49 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_50": $data->archive_50 = Helper::uploadMultiplesArchives($request->file($index)); break; } $data->register_id = $IdRegister; $data->origin = date("Y-m-d"); $data->user_id = Helper::getAuth()->id; $data->save(); } } $data = new Model5(); $data->register_id = $IdRegister; $data->user_id = Helper::getAuth()->id; $data->save(); return $IdRegister; } return false; } private function processFirstDocumentaryGroup($request, $row, $id = false) { $data = $id ? Model1::find($id) : new Model1(); $data->metadata_01 = is_null($request->get("metadata_01P")) || is_null($request->get("metadata_01P")[$row]) ? '' : $request->get("metadata_01P")[$row]; $data->metadata_02 = is_null($request->get("metadata_02P")) || is_null($request->get("metadata_02P")[$row]) ? '' : $request->get("metadata_02P")[$row]; $data->metadata_03 = is_null($request->get("metadata_03P")) || is_null($request->get("metadata_P")[$row]) ? '' : $request->get("metadata_03P")[$row]; $data->metadata_04 = is_null($request->get("metadata_04P")) || is_null($request->get("metadata_P")[$row]) ? '' : $request->get("metadata_04P")[$row]; $data->metadata_05 = is_null($request->get("metadata_05P")) || is_null($request->get("metadata_P")[$row]) ? '' : $request->get("metadata_05P")[$row]; $data->metadata_06 = is_null($request->get("metadata_06P")) || is_null($request->get("metadata_P")[$row]) ? '' : $request->get("metadata_06P")[$row]; $data->metadata_07 = is_null($request->get("metadata_07P")) || is_null($request->get("metadata_07P")[$row]) ? '' : $request->get("metadata_P")[$row]; $data->metadata_08 = is_null($request->get("metadata_08P")) || is_null($request->get("metadata_08P")[$row]) ? '' : $request->get("metadata_08P")[$row]; $data->metadata_09 = is_null($request->get("metadata_09P")) || is_null($request->get("metadata_09P")[$row]) ? '' : $request->get("metadata_09P")[$row]; $data->metadata_10 = is_null($request->get("metadata_10P")) || is_null($request->get("metadata_10P")[$row]) ? '' : $request->get("metadata_P")[$row]; $data->category_id = $request->get("category_id"); $data->user_id = Helper::getAuth()->id; $data->save(); $idFirst = $id ? $id : $data->id; for ($i = 0; $i < 10; $i++) { $index = "archive_" . str_pad((string) ($i + 1), 2, "0", STR_PAD_LEFT) . "P"; if ($request->hasfile($index) && isset($request->file($index)[$row])) { $data = new Model6(); switch ($index) { case "archive_01P": $data->archive_01 = Helper::uploadArchive($request->file($index)[$row]); break; case "archive_02P": $data->archive_02 = Helper::uploadArchive($request->file($index)[$row]); break; case "archive_03P": $data->archive_03 = Helper::uploadArchive($request->file($index)[$row]); break; case "archive_04P": $data->archive_04 = Helper::uploadArchive($request->file($index)[$row]); break; case "archive_P": $data->archive_05 = Helper::uploadArchive($request->file($index)[$row]); break; case "archive_06P": $data->archive_06 = Helper::uploadArchive($request->file($index)[$row]); break; case "archive_07P": $data->archive_07 = Helper::uploadArchive($request->file($index)[$row]); break; case "archive_08P": $data->archive_08 = Helper::uploadArchive($request->file($index)[$row]); break; case "archive_09P": $data->archive_09 = Helper::uploadArchive($request->file($index)[$row]); break; case "archive_10P": $data->archive_10 = Helper::uploadArchive($request->file($index)[$row]); break; } $data->first_documentary_group_id = $idFirst; $data->origin = date("Y-m-d"); $data->user_id = Helper::getAuth()->id; $data->save(); } } $data = new Model4(); $data->first_documentary_group_id = $idFirst; $data->user_id = Helper::getAuth()->id; $data->save(); return $idFirst; } private function processRelations($register, $firstDocumentaryGroup) { $data = new Model3(); $data->user_id = Helper::getAuth()->id; $data->register_id = $register; $data->first_documentary_group_id = $firstDocumentaryGroup; $data->save(); } public function updatedPrince(Request $request) { $request->validate(array("id" => "required|regex:/^[0-9]+$/|max:", "hash" => "required|regex:/^[0-9A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_" => "required|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_02" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_03" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_04" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_05" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_07" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_08" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_09" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_10" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_02.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_04.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_05.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_07.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_08.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_09.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"))); $data = Model1::find($request->get("id")); $data->metadata_01 = is_null($request->get("metadata_01")) ? '' : $request->get("metadata_"); $data->metadata_02 = is_null($request->get("metadata_02")) ? '' : $request->get("metadata_02"); $data->metadata_03 = is_null($request->get("metadata_03")) ? '' : $request->get("metadata_03"); $data->metadata_04 = is_null($request->get("metadata_")) ? '' : $request->get("metadata_04"); $data->metadata_05 = is_null($request->get("metadata_")) ? '' : $request->get("metadata_05"); $data->metadata_06 = is_null($request->get("metadata_06")) ? '' : $request->get("metadata_06"); $data->metadata_07 = is_null($request->get("metadata_")) ? '' : $request->get("metadata_07"); $data->metadata_08 = is_null($request->get("metadata_08")) ? '' : $request->get("metadata_08"); $data->metadata_09 = is_null($request->get("metadata_09")) ? '' : $request->get("metadata_09"); $data->metadata_10 = is_null($request->get("metadata_10")) ? '' : $request->get("metadata_"); $data->user_id = Helper::getAuth()->id; $data->save(); for ($i = 0; $i < 10; $i++) { $index = "archive_" . str_pad((string) ($i + 1), 2, "0", STR_PAD_LEFT); if ($request->hasfile($index)) { $data = new Model6(); switch ($index) { case "archive_01": $data->archive_01 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_02": $data->archive_02 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_03 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_04": $data->archive_04 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_05": $data->archive_05 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_06 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_07": $data->archive_07 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_08": $data->archive_08 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_09": $data->archive_09 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_10": $data->archive_10 = Helper::uploadMultiplesArchives($request->file($index)); break; } $data->first_documentary_group_id = $request->get("id"); $data->origin = date("Y-m-d"); $data->user_id = Helper::getAuth()->id; $data->save(); } } $data = new Model4(); $data->first_documentary_group_id = $request->get("id"); $data->user_id = Helper::getAuth()->id; $data->save(); return redirect("/register/beginning/" . $request->get("hash"))->with("success", "Documento/Cliente Actualizado Exitosamente"); } public function registerSecondary(Request $request) { $request->validate(array("hash" => "required|regex:/^[0-9A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "id" => "required|regex:/^[0-9]+$/|max:2", "metadata_01" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_02" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_03" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_05" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|maxҭ", "metadata_" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_07" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_08" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_09" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_12" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_13" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_17" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_18" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_19" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_20" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_21" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_22" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_23" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_24" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_25" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_26" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_27" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_28" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_29" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_30" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_31" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_32" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_34" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_35" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_36" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_37" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_38" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_39" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_40" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_43" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_44" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_45" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_46" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_47" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_48" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_49" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_50" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_02.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_03.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_04.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_07.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_08.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_09.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_11.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_12.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_13.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_15.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_16.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_18.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_19.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_22.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_24.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_25.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_27.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_28.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_29.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_30.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_32.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_36.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_37.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_38.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_39.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_41.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_42.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_43.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_44.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_46.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_47.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_48.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_49.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_50.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"))); $id = $request->get("id"); $id_category = DB::table("first_documentary_groups")->where("id", $id)->get(array("category_id"))->first(); $data = new Model2(); $data->metadata_01 = is_null($request->get("metadata_01")) ? '' : $request->get("metadata_01"); $data->metadata_02 = is_null($request->get("metadata_")) ? '' : $request->get("metadata_02"); $data->metadata_03 = is_null($request->get("metadata_03")) ? '' : $request->get("metadata_"); $data->metadata_04 = is_null($request->get("metadata_")) ? '' : $request->get("metadata_"); $data->metadata_05 = is_null($request->get("metadata_05")) ? '' : $request->get("metadata_05"); $data->metadata_06 = is_null($request->get("metadata_")) ? '' : $request->get("metadata_"); $data->metadata_07 = is_null($request->get("metadata_07")) ? '' : $request->get("metadata_"); $data->metadata_08 = is_null($request->get("metadata_08")) ? '' : $request->get("metadata_08"); $data->metadata_09 = is_null($request->get("metadata_09")) ? '' : $request->get("metadata_09"); $data->metadata_10 = is_null($request->get("metadata_")) ? '' : $request->get("metadata_"); $data->metadata_11 = is_null($request->get("metadata_11")) ? '' : $request->get("metadata_"); $data->metadata_12 = is_null($request->get("metadata_12")) ? '' : $request->get("metadata_12"); $data->metadata_13 = is_null($request->get("metadata_13")) ? '' : $request->get("metadata_13"); $data->metadata_14 = is_null($request->get("metadata_14")) ? '' : $request->get("metadata_14"); $data->metadata_15 = is_null($request->get("metadata_15")) ? '' : $request->get("metadata_15"); $data->metadata_16 = is_null($request->get("metadata_16")) ? '' : $request->get("metadata_16"); $data->metadata_17 = is_null($request->get("metadata_")) ? '' : $request->get("metadata_17"); $data->metadata_18 = is_null($request->get("metadata_18")) ? '' : $request->get("metadata_18"); $data->metadata_19 = is_null($request->get("metadata_19")) ? '' : $request->get("metadata_19"); $data->metadata_20 = is_null($request->get("metadata_20")) ? '' : $request->get("metadata_20"); $data->metadata_21 = is_null($request->get("metadata_21")) ? '' : $request->get("metadata_21"); $data->metadata_22 = is_null($request->get("metadata_22")) ? '' : $request->get("metadata_22"); $data->metadata_23 = is_null($request->get("metadata_")) ? '' : $request->get("metadata_23"); $data->metadata_24 = is_null($request->get("metadata_24")) ? '' : $request->get("metadata_24"); $data->metadata_25 = is_null($request->get("metadata_25")) ? '' : $request->get("metadata_25"); $data->metadata_26 = is_null($request->get("metadata_26")) ? '' : $request->get("metadata_"); $data->metadata_27 = is_null($request->get("metadata_")) ? '' : $request->get("metadata_27"); $data->metadata_28 = is_null($request->get("metadata_28")) ? '' : $request->get("metadata_28"); $data->metadata_29 = is_null($request->get("metadata_29")) ? '' : $request->get("metadata_29"); $data->metadata_30 = is_null($request->get("metadata_30")) ? '' : $request->get("metadata_30"); $data->metadata_31 = is_null($request->get("metadata_31")) ? '' : $request->get("metadata_31"); $data->metadata_32 = is_null($request->get("metadata_")) ? '' : $request->get("metadata_32"); $data->metadata_33 = is_null($request->get("metadata_33")) ? '' : $request->get("metadata_33"); $data->metadata_34 = is_null($request->get("metadata_34")) ? '' : $request->get("metadata_34"); $data->metadata_35 = is_null($request->get("metadata_35")) ? '' : $request->get("metadata_"); $data->metadata_36 = is_null($request->get("metadata_36")) ? '' : $request->get("metadata_36"); $data->metadata_37 = is_null($request->get("metadata_37")) ? '' : $request->get("metadata_37"); $data->metadata_38 = is_null($request->get("metadata_38")) ? '' : $request->get("metadata_38"); $data->metadata_39 = is_null($request->get("metadata_39")) ? '' : $request->get("metadata_39"); $data->metadata_40 = is_null($request->get("metadata_")) ? '' : $request->get("metadata_"); $data->metadata_41 = is_null($request->get("metadata_")) ? '' : $request->get("metadata_"); $data->metadata_42 = is_null($request->get("metadata_42")) ? '' : $request->get("metadata_"); $data->metadata_43 = is_null($request->get("metadata_43")) ? '' : $request->get("metadata_43"); $data->metadata_44 = is_null($request->get("metadata_44")) ? '' : $request->get("metadata_"); $data->metadata_45 = is_null($request->get("metadata_")) ? '' : $request->get("metadata_45"); $data->metadata_46 = is_null($request->get("metadata_46")) ? '' : $request->get("metadata_"); $data->metadata_47 = is_null($request->get("metadata_47")) ? '' : $request->get("metadata_47"); $data->metadata_48 = is_null($request->get("metadata_48")) ? '' : $request->get("metadata_48"); $data->metadata_49 = is_null($request->get("metadata_49")) ? '' : $request->get("metadata_49"); $data->metadata_50 = is_null($request->get("metadata_50")) ? '' : $request->get("metadata_50"); $data->category_id = $id_category->category_id; $data->user_id = Helper::getAuth()->id; $data->save(); $IdRegister = $data->id; for ($i = 0; $i < $this->countArchive; $i++) { $index = "archive_" . str_pad((string) ($i + 1), 2, "0", STR_PAD_LEFT); if ($request->hasfile($index)) { $data = new Model7(); switch ($index) { case "archive_01": $data->archive_01 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_02": $data->archive_02 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_03 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_04": $data->archive_04 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_05": $data->archive_05 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_06": $data->archive_06 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_07": $data->archive_07 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_08": $data->archive_08 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_09": $data->archive_09 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_10": $data->archive_10 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_11": $data->archive_11 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_12 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_13": $data->archive_13 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_14": $data->archive_14 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_15": $data->archive_15 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_16": $data->archive_16 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_17": $data->archive_17 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_18": $data->archive_18 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_19": $data->archive_19 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_20": $data->archive_20 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_21": $data->archive_21 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_22": $data->archive_22 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_23 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_24": $data->archive_24 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_25": $data->archive_25 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_26 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_27": $data->archive_27 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_28": $data->archive_28 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_29": $data->archive_29 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_30": $data->archive_30 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_31": $data->archive_31 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_32": $data->archive_32 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_33 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_34": $data->archive_34 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_35": $data->archive_35 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_36": $data->archive_36 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_37": $data->archive_37 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_38": $data->archive_38 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_39": $data->archive_39 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_40": $data->archive_40 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_41 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_42 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_43": $data->archive_43 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_44": $data->archive_44 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_45": $data->archive_45 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_": $data->archive_46 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_47": $data->archive_47 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_48": $data->archive_48 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_49": $data->archive_49 = Helper::uploadMultiplesArchives($request->file($index)); break; case "archive_50": $data->archive_50 = Helper::uploadMultiplesArchives($request->file($index)); break; } $data->register_id = $IdRegister; $data->origin = date("Y-m-d"); $data->user_id = Helper::getAuth()->id; $data->save(); } } $data = new Model3(); $data->user_id = Helper::getAuth()->id; $data->register_id = $IdRegister; $data->first_documentary_group_id = $id; $data->save(); $data = new Model5(); $data->register_id = $IdRegister; $data->user_id = Helper::getAuth()->id; $data->save(); return redirect("/register/beginning/" . $request->get("hash"))->with("success", "Documento/Cliente Registrado Exitosamente"); } public function updatedSecondary(Request $request) { $request->validate(array("id" => "required|regex:/^[0-9]+$/|max:50", "hash" => "required|regex:/^[0-9A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_01" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_02" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_03" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_04" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_05" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_06" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_07" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_08" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_09" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|maxҭ", "metadata_" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_12" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_13" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_14" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_17" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_18" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_19" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_20" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|maxҭ", "metadata_21" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_23" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_24" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_25" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|maxҭ", "metadata_26" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_28" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_29" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_31" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_32" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_33" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_34" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_35" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_36" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|maxҭ", "metadata_38" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_39" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_40" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:5", "metadata_41" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_42" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_44" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_46" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:2", "metadata_47" => "nullable|regex:/^[ "#%&(),-.\x-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_48" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max55", "metadata_49" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "metadata_50" => "nullable|regex:/^[ "#%&(),-.\/0-9:;A-Za-zÁÉÍÑÓÚáéíñóú]+$/|max:255", "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_02.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_04.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_06.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_08.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_09.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_10.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_11.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_12.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_13.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_14.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_15.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_18.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_19.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_20.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_22.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_23.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_24.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_25.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_26.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_28.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_29.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_30.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_33.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_34.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_35.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_36.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_37.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_38.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_39.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_40.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_41.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_43.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_44.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_47.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_48.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_49.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"), "archive_50.*" => "nullable|max:" . config("global.MAX_SIZE_DOC") . "|mimes:" . config("global.FORMATS"))); $this->processRegister($request, $request->get("id")); return redirect("/register/beginning/" . $request->get("hash"))->with("success", "Documento/Cliente Actualizado Exitosamente"); } public function deleteArchivePrince($id) { $data = Model6::find($id); $data->state = "Inactivo"; $data->user_id = Helper::getAuth()->id; $data->save(); $resp = array("ok" => true, "message" => array("title" => "Exitoso", "text" => "Archivo Eliminado Exitosamente", "icon" => "success")); return response()->json($resp, 200); } public function deleteArchiveSecondary($id) { $data = Model7::find($id); $data->state = "Inactivo"; $data->user_id = Helper::getAuth()->id; $data->save(); $resp = array("ok" => true, "message" => array("title" => "Exitoso", "text" => "Archivo Eliminado Exitosamente", "icon" => "success")); return response()->json($resp, 200); } public function deleteSecondary($id) { $id = explode("-", $id); $hash = $id[0]; $id = $id[1]; $data = Model2::find($id); $data->state = "Inactivo"; $data->user_id = Helper::getAuth()->id; $data->save(); return redirect("/register/beginning/" . $hash)->with("success", "Registro Eliminado Exitosamente"); } } 



© 2023 Quttera Ltd. All rights reserved.