mirror of
https://github.com/freescout-helpdesk/freescout.git
synced 2024-11-24 03:12:46 +01:00
Allow to get via phone conversation last reply via getLastReply()
This commit is contained in:
parent
9e7f2e22dd
commit
79aca06be8
@ -398,10 +398,14 @@ class Conversation extends Model
|
||||
*
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function getLastReply()
|
||||
public function getLastReply($include_phone_replies = false)
|
||||
{
|
||||
$types = [Thread::TYPE_CUSTOMER, Thread::TYPE_MESSAGE];
|
||||
if ($include_phone_replies && $this->isPhone()) {
|
||||
$types[] = Thread::TYPE_NOTE;
|
||||
}
|
||||
return $this->threads()
|
||||
->whereIn('type', [Thread::TYPE_CUSTOMER, Thread::TYPE_MESSAGE])
|
||||
->whereIn('type', $types)
|
||||
->where('state', Thread::STATE_PUBLISHED)
|
||||
->orderBy('created_at', 'desc')
|
||||
->first();
|
||||
|
Loading…
Reference in New Issue
Block a user