sintret-2017 / yii2-chat-adminlte

带有admin lte的Chat插件Yii2扩展

安装: 28

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 29

公开问题: 0

类型:yii2-extension

v1.0.0 2015-01-14 13:46 UTC

This package is auto-updated.

Last update: 2024-09-17 11:27:25 UTC


README

yii2聊天小部件 widget admin lte

修复bug:yii2-chat-adminlte 尝试获取非对象属性 $model->user->username

删除头像

通过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:您的User类中的头像图片源,例如:avatarImage