Ejemplo n.º 1
0
 public function sendMessage(Request $request)
 {
     $user = Session::get('user');
     $idGroup = $request->input('idGroup');
     $message = $request->input('message');
     $chatType = 0;
     $idSticker = -1;
     $idStickerGroup = -1;
     if ($idGroup > 0) {
         $isUserInGroupChatResult = self::$factory->checkMemberInGroupChat($idGroup, $user['ID_USER']);
         if ($isUserInGroupChatResult == 1) {
             $addChatMessageResult = self::$factory->addChatMessage($user['ID_USER'], $idGroup, $chatType, $idSticker, $idStickerGroup, Utils::encodeParameter($message));
             dd($addChatMessageResult);
             if (count($addChatMessageResult) > 0) {
                 $processNotification = self::$factory->processChatNotification($addChatMessageResult[0]['ID_GROUP'], $addChatMessageResult[0]['ID_CHAT']);
             }
             return Response::make($addChatMessageResult);
         }
     }
 }
Ejemplo n.º 2
0
 public function processRegister(Request $request)
 {
     $rules = array('Name' => 'required|max:100', 'Surname' => 'required|max:100', 'Position' => 'required|max:100', 'Mobile' => 'required|max:10', 'Email' => 'required|email|max:100', 'Password' => 'required|confirmed|max:100', 'Password_confirmation' => 'required');
     $message = ['Name.required' => 'Name is Required.', 'Name.max' => 'Name length must be less than or equals 100 character.', 'Surname.required' => 'SurName is Required.', 'Surname.max' => 'SurName length must be less than or equals 100 character.', 'Position.required' => 'Position is Required.', 'Position.max' => 'Position length must be less than or equals 100 character.', 'Mobile.required' => 'Mobile is Required.', 'Mobile.max' => 'Mobile length must be less than or equals 100 character.', 'Email.required' => 'Email is Required.', 'Email.email' => 'Email format not correct.', 'Email.max' => 'Email length must be less than or equals 10 character.', 'Password.required' => 'Password is Required.', 'Password.confirmed' => 'Password not match.', 'Password_confirmation.required' => 'Password Confirm is Required.', 'Password.max' => 'Password length must be less than or equals 100 character.'];
     $validator = Validator::make($request->all(), $rules, $message);
     if ($validator->fails()) {
         return redirect('register')->withErrors($validator)->withInput();
     } else {
         $name = $request->input('Name');
         $surName = $request->input('Surname');
         $position = $request->input('Position');
         $mobile = $request->input('Mobile');
         $email = $request->input('Email');
         $password = $request->input('Password');
         $isExistTelephoneResult = self::$factory->callWebservice(['query' => ['service' => 'isExistTelephone', 'telephone' => Utils::encodeParameter($mobile)]]);
         if ($isExistTelephoneResult["data"][0]["result"] == 1) {
             Session::flash('alert-danger', 'Mobile already to use');
             return redirect('register')->withinput();
         }
         $isExistEmailResult = self::$factory->callWebservice(['query' => ['service' => 'isExistEmail', 'email' => Utils::encodeParameter($email)]]);
         if ($isExistEmailResult["data"][0]["result"] == 1) {
             Session::flash('alert-danger', 'Email already to use');
             return redirect('register')->withInput();
         }
         $registerResult = self::$factory->callWebservice(['query' => ['service' => 'addUser', 'firstName' => Utils::encodeParameter($name), 'lastName' => Utils::encodeParameter($surName), 'telephone' => Utils::encodeParameter($mobile), 'email' => Utils::encodeParameter($email), 'position' => Utils::encodeParameter($position), 'password' => Utils::encodeParameter($password)]]);
         Session::flash('alert-success', 'Register Successful');
         return redirect('/');
     }
 }