public function return_name_doc_relacionado()
 {
     if (!Request::ajax() || !Auth::check()) {
         return Response::json(array('success' => false), 200);
     }
     $id = Auth::id();
     $data["inside_url"] = Config::get('app.inside_url');
     $data["user"] = Session::get('user');
     if ($data["user"]->idrol == 1 || $data["user"]->idrol == 2 || $data["user"]->idrol == 3 || $data["user"]->idrol == 4 || $data["user"]->idrol == 5 || $data["user"]->idrol == 6 || $data["user"]->idrol == 7 || $data["user"]->idrol == 8 || $data["user"]->idrol == 9 || $data["user"]->idrol == 10 || $data["user"]->idrol == 11 || $data["user"]->idrol == 12) {
         // Check if the current user is the "System Admin"
         $data = Input::get('selected_id');
         $documento = Documento::searchDocumentoByCodigoArchivamiento($data)->get();
         if ($documento->isEmpty()) {
             $documento = null;
             $ot = null;
         } else {
             $documento = $documento[0];
             if ($documento->idtipo_documento != 17) {
                 $documento = null;
                 $ot = null;
             } else {
                 $ot = OrdenesTrabajoVerifMetrologica::searchOtVerifMetrologicaByIdDocumento($documento->iddocumento)->get();
                 if ($ot->isEmpty()) {
                     $ot = null;
                 } else {
                     $ot = $ot[0];
                 }
             }
         }
         return Response::json(array('success' => true, 'contrato' => $documento, 'ot' => $ot), 200);
     } else {
         return Response::json(array('success' => false), 200);
     }
 }