本文整理汇总了PHP中Chat::messages方法的典型用法代码示例。如果您正苦于以下问题:PHP Chat::messages方法的具体用法?PHP Chat::messages怎么用?PHP Chat::messages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chat
的用法示例。
在下文中一共展示了Chat::messages方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
<i class="icon-speech"></i> Activities </a>
</li>
<li class="divider">
</li>
<li>
<a href="#quick_sidebar_tab_3" data-toggle="tab">
<i class="icon-settings"></i> Settings </a>
</li>
</ul>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active page-quick-sidebar-chat" id="chatbox">
<div class="page-quick-sidebar-chat-users" data-rail-color="#ddd" data-wrapper-class="page-quick-sidebar-list">
<?php
$messages = Chat::messages();
?>
<h3 class="list-heading">Staffs</h3>
<ul id="staff-chatters" class="media-list list-items">
@if( isset($messages['admin']) )
@foreach($messages['admin'] as $message)
<li class="media" data-chatter-id="{{ $message['from_id'] }}">
<div class="media-status">
@if($message['new_message'])
<span class="badge badge-success">{{ $message['new_message'] }}</span>
@endif
</div>
<img class="media-object" src="{{ URL.'/'.$message['avatar'] }}" alt="...">
<div class="media-body">
<h4 class="media-heading">
{{ $message['from'] }}
示例2: it_can_return_paginated_messages_in_a_conversation
/** @test */
public function it_can_return_paginated_messages_in_a_conversation()
{
$users = $this->createUsers(3);
$conversation = Chat::createConversation([$users[0]->id, $users[1]->id]);
for ($i = 0; $i < 50; $i++) {
Chat::send($conversation->id, 'Hello ' . $i, $users[0]->id);
Chat::send($conversation->id, 'Hello Man ' . $i, $users[1]->id);
}
Chat::send($conversation->id, 'Hello Man', $users[1]->id);
$this->assertEquals($conversation->messages->count(), 101);
$perPage = 50;
$page = 1;
$this->assertEquals(Chat::messages($users[0]->id, $conversation->id, $perPage, $page)->count(), 50);
$this->assertEquals(Chat::messages($users[0]->id, $conversation->id, $perPage, $page + 1)->count(), 50);
$this->assertEquals(Chat::messages($users[0]->id, $conversation->id, $perPage, $page + 2)->count(), 1);
$this->assertEquals(Chat::messages($users[0]->id, $conversation->id, $perPage, $page + 3)->count(), 0);
}