public static function fromResponse($data) { return isset($data['title']) ? GroupChat::fromResponse($data) : User::fromResponse($data); }
public function groupDeleteMember($gcid) { $in = Input::all(); $groupChat = GroupChat::where('ID', $gcid)->first(); if ($groupChat->StudentID == Auth::user()->StudentID) { GroupChatMember::where('GCID', $gcid)->where('StudentID', $in['AccID'])->update(['delFlag' => 1]); return 'ok'; } }
* 4. there are two special variables : $action & $request. $action used by * switch to determine the action the request is asking us to perform. $request will contain all the other * parameters that were included in json request * */ include_once 'bootstrap.php'; include_once 'GroupChat.php'; //include_once 'Chat.php'; #$data = '{"action": "getmsg", "phone": "2347066192100"}'; #$data = '{"action":"receiverstatusmsg","receiver":"2348105364269","status":"w"}'; #$data = '{"action":"msgbystatus","phone":"2347066192100","status":"r #$data = '{"action":"msgbychatkey","chatkey":"23470661921002348105364269"}' # $data = '{"action": "update", "authkey": "770073e57a7fcf79760c1555bdc5a908","fname":"Jo","lname":"Ogbimi","email":"*****@*****.**","photo":"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wAARCABkAGQDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19"}'; #$data = 'http://83.138.190.170/fuse/chat.php?json={%22action%22:%22sendmessage%22,%22msgid%22:%222347%22,%22chatkey%22:%2223470661921002348105364269%22,%22authkey%22:%22770073e57a7fcf79760c1555bdc5a908%22,%22sender%22:%222347066192100%22,%22receiver%22:%222348105364269%22,%22msgtype%22:%22text%22,%22msg%22:%22hello%20there%22,%22status%22:%22w%22}'; #exit; $groupchat = new GroupChat(); switch ($action) { case 'creategroup': App::setJSONResponse($groupchat->createGroup($request['owner'], $request['groupname'], $request['members'])); #App::setJSONResponse($groupchat->sendMessage($request['msgid'])); break; case 'addtogroup': App::setJSONResponse($groupchat->addToGroup($request['owner'], $request['groupid'], $request['members'])); #App::setJSONResponse($groupchat->getMessage()); break; case 'exitgroup': App::setJSONResponse($groupchat->exitGroup($request['groupid'], $request['member'])); break; case 'adminexit': App::setJSONResponse($groupchat->adminDeleteExit($request['groupid'], $request['owner'])); break;
/** * @param array $attributes */ public function loadRelated(array $attributes) { parent::loadRelated($attributes); if (isset($attributes['from'])) { $this->from = User::create($attributes['from']); } if (isset($attributes['chat'])) { $this->chat = isset($attributes['chat']->title) ? GroupChat::create($attributes['chat']) : User::create($attributes['chat']); } if (isset($attributes['forward_from'])) { $this->forward_from = User::create($attributes['forward_from']); } if (isset($attributes['forward_from_chat'])) { $this->forward_from_chat = Chat::create($attributes['forward_from_chat']); } if (isset($attributes['reply_to_message'])) { $this->reply_to_message = Message::create($attributes['reply_to_message']); } if (isset($attributes['entities'])) { $this->entities = array_map(function ($entity) { return MessageEntity::create($entity); }, $attributes['entities']); } if (isset($attributes['audio'])) { $this->audio = Audio::create($attributes['audio']); } if (isset($attributes['document'])) { $this->document = Document::create($attributes['document']); } if (isset($attributes['photo'])) { $this->photo = array_map(function ($photo) { return PhotoSize::create($photo); }, $attributes['photo']); } if (isset($attributes['sticker'])) { $this->sticker = Sticker::create($attributes['sticker']); } if (isset($attributes['video'])) { $this->video = Video::create($attributes['video']); } if (isset($attributes['voice'])) { $this->voice = Voice::create($attributes['voice']); } if (isset($attributes['contact'])) { $this->contact = Contact::create($attributes['contact']); } if (isset($attributes['location'])) { $this->location = Location::create($attributes['location']); } if (isset($attributes['venue'])) { $this->venue = Venue::create($attributes['venue']); } if (isset($attributes['new_chat_member'])) { $this->new_chat_member = User::create($attributes['new_chat_member']); } if (isset($attributes['left_chat_member'])) { $this->left_chat_member = new User($attributes['left_chat_member']); } if (isset($attributes['new_chat_photo'])) { $this->new_chat_photo = array_map(function ($photo) { return PhotoSize::create($photo); }, $attributes['new_chat_photo']); } }
public function parseChat($chatObject) { if (property_exists($chatObject, 'title')) { $groupChat = new GroupChat(); $groupChat->setId($chatObject->id); $groupChat->setTitle($chatObject->title); return $groupChat; } return $this->parseUser($chatObject); }