2015-05-19 120 views
0

我已经安装了Cmgmyr \ Messenger,但是,由于我的用户表不包含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提起被称为?这就是需要改变的用户名,甚至更好的users.firstname和users.lastname在一起。

我需要把它扩大到以下结构:

Modules/ 
- Email/ 
    - Models/ 
    - Thread.php 

我怎么能去呢?

回答

0

最简单的方法是在github上分发软件包,自己对软件包进行更改,然后在composer(而不是原始软件包)中插入自定义软件包。

这样,您可以保持对其他包装上的更改的控制权。

在你的叉子拉动具体方法是这里介绍: How to require a fork with composer

+0

@TheRabbitFactory - 这样做,回答你的问题?你需要更多信息吗? – Laurence