2015-05-19 196 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