public function allNoValidate()
 {
     $regNoVal = $this->registro->where('reg_validacion', 0)->where('reg_fin', '<>', '00:00:00')->orderBy('id_serv')->get();
     $servicio = new Servicio();
     $regNoVal->each(function ($item, $key) use($servicio) {
         $item->translateToUser();
         $item->serv = $servicio->findById($item->idServ, true);
     });
     return $this->user->response(response(), compact('regNoVal'), 200);
 }
示例#2
0
 private function responseToken($data)
 {
     if (is_array($data)) {
         if ($data['type'] == 'servicio') {
             $servicio = Servicio::find($data['data']['id_serv']);
             if (!$servicio->serv_activo) {
                 throw new RestException(__FILE__, "Sin acceso a la plataforma.", 403, ["message" => "Sin acceso a la plataforma."]);
             }
             $ips = [];
             (new Ip())->allThem()->each(function ($item, $key) use(&$ips) {
                 array_push($ips, $item->ipp);
             });
             if (!in_array($_SERVER['REMOTE_ADDR'], $ips)) {
                 throw new RestException(__FILE__, "Ip desconocida.", 403, ["message" => "Ip desconocida."]);
             }
         }
         $token = TokenFromUser::getToken($data);
         $type = $data['type'];
         return response()->json(compact("token", "type"), 200);
     }
     return null;
 }