sinret / yii2-chat-adminlte
支持AdminLTE的Yii2聊天插件扩展
v1.0.0
2015-01-14 13:46 UTC
Requires
This package is not auto-updated.
Last update: 2024-09-20 00:07:04 UTC
README
yii2聊天小部件,widget admin lte
通过Composer添加
"sintret/yii2-chat-adminlte": "dev-master"
您只需使用此命令将聊天表添加到数据库
CREATE TABLE `chat` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `userId` INT(11) DEFAULT NULL, `message` TEXT, `updateDate` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=INNODB;
并在视图中调用小部件
在控制器中,例如ChatController的sendChat动作
public function actionSendChat() { if (!empty($_POST)) { echo \sintret\chat\ChatRoom::sendChat($_POST); } }
此小部件的附加属性
url : 使用Ajax发送消息的控制器/操作
userModel : 您的用户模型类名
userField : 您用户类中的头像图片源,例如:avatarImage