<取り組んでいること>
chat形式のメッセージボックスを作成しています。
https://gyazo.com/09a0198c4ed563c30b55227e476f249d
<質問>
・DBに値をinsertすることでメッセージを送れる仕様となります。
・上記のリンクの場合、Tes Providerがメッセージの受信者(receiver)となります。
・他のreceiverもいる中で、正確にTes providerに送るためには、どのようにreceiverIdの変数を書いたら良いのでしょうか?(以下のコードの[ここが不明]部分になります)。
・'receiverId => 〇〇〇〇['userId],
とし、〇〇〇〇部分でuserIdを絞り込む条件設定が必要だと考えておりますが、うまく行きません(単純なメッセージのやりとりのため、絞り込む付帯条件がない感じです)
・例えば、上記リンクの左側の受信者名をクリックすることで、cssのclassが適用されますが、〇〇〇〇の部分にcssのclassなどを当てはめ、userIdを絞り込むことはできるのでしょうか。
・わかりにくい質問で申し訳ありませんが、お分かりの方はご教示いただけると幸いです。
PHP
1public function sendMessage(){ 2 3 extract($this -> reqData); 4 $desc = (isset($description) && trim($description) != null) ? trim($description) : null; 5 $receiveduser = 6 7 if ($desc != null) { 8 9 $lastId = $this -> db -> insert('tbl_messages', 10 array( 11 12 'senderId' => $this->sessUserId, 13 'receiverId' => [ここが不明], 14 'type' => 'user', 15 'description' => $description, 16 'createdDate' => date('Y-m-d H:i:s'), 17 18 ))->lastInsertId();
あなたの回答
tips
プレビュー