我已经安装了 Cmgmyr\Messenger,但是,我需要扩展 Thread 模型和可能的其他几个模型,因为我的 users 表不包含name
字段。
我需要扩展的方法是:
/**
* Generates a string of participant information
*
* @param null $userId
* @param array $columns
* @return string
*/
public function participantsString($userId=null, $columns=['name'])
{
$selectString = $this->createSelectString($columns);
$participantNames = $this->getConnection()->table('users')
->join('participants', 'users.id', '=', 'participants.user_id')
->where('participants.thread_id', $this->id)
->select($this->getConnection()->raw($selectString));
if ($userId !== null) {
$participantNames->where('users.id', '!=', $userId);
}
$userNames = $participantNames->lists('users.name');
return implode(', ', $userNames);
}
注意到 users.name 文件被调用了吗?这是需要更改为 username 甚至更好的 users.firstname 和 users.lastname 一起的内容。
我需要将其扩展到以下结构:
Modules/
- Email/
- Models/
- Thread.php
我该怎么办?