本文整理汇总了PHP中app\Message::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::all方法的具体用法?PHP Message::all怎么用?PHP Message::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Message
的用法示例。
在下文中一共展示了Message::all方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: numberUnreadMessages
public function numberUnreadMessages()
{
$count = 0;
foreach (\App\Message::all() as $message) {
if ($message->to == \Auth::User()->id && $message->read == 0) {
$count++;
}
}
return $count;
}
示例2: getMessage
/**
* To handle all the mesaging functionality
*
* @param int $id
* @return Response
*/
public function getMessage(Request $request)
{
$userId = Auth::user()->email;
$messageReceipaient = MessageReceipient::where('receipient_ID', $userId)->get();
$metaIds = array();
//storing all the message recepiaent
foreach ($messageReceipaient as $key => $value) {
$metaIds[] = $value['meta_Id'];
}
//fetching all the message to display
$messageReceipaientResult = Message::all();
return $messageReceipaientResult;
}
示例3: onMessage
public function onMessage(ConnectionInterface $from, $msg)
{
$numRecv = count($this->clients) - 1;
echo sprintf('Connection %d sending message "%s" to %d other connection%s' . "\n", $from->resourceId, $msg, $numRecv, $numRecv == 1 ? '' : 's');
$data = json_decode($msg);
if ($data->status == 'ping') {
$data->status == 'pong';
$from->send(json_encode($data));
}
if ($data->status == 'open') {
$current_user = \App\ChatOnlineUser::where('username', '=', $data->username)->first();
print_r(empty((array) $current_user));
if (!empty($current_user)) {
\App\ChatOnlineUser::where('username', '=', $data->username)->delete();
}
$chat_user_data = array('username' => $data->username, 'name' => $data->name, 'connection_resource_id' => $from->resourceId);
$online_users = \App\ChatOnlineUser::all();
$data->online_users = $online_users->toArray();
\App\ChatOnlineUser::create($chat_user_data);
$messages = \App\Message::all();
$data->content = $messages->toArray();
foreach ($this->clients as $client) {
//if ($from !== $client) {
$client->send(json_encode($data));
//}
}
}
if ($data->status == 'close') {
foreach ($this->clients as $client) {
if ($from !== $client) {
$client->send($msg);
}
}
}
if ($data->status == 'message') {
$message_data = array('username' => $data->username, 'name' => $data->name, 'message_contents' => $data->content);
\App\Message::create($message_data);
foreach ($this->clients as $client) {
if ($from !== $client) {
$client->send($msg);
}
}
}
}
示例4: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
return Message::all()->toJson();
}
示例5: discussion
/**
* Display Project Discussion page
*
* @return \Illuminate\View\View
*/
public function discussion()
{
$messages = Message::all();
return view('projects.discussion', compact('messages'));
}
示例6: index
public function index()
{
$data['chats'] = Message::all();
return view('index', $data);
}
示例7: function
# ------------------ bookmark stuff ------------------------
post('api/bookmark', function () {
Auth::user()->bookmark = Request::get('bookmark');
Auth::user()->save();
});
get('api/bookmark', function () {
return Auth::user()->bookmark;
});
# ------------------ guestbook stuff ------------------------
use App\Message;
get('guestbook', function () {
return view('guestbook/guestbook');
});
// API
get('api/messages', function () {
return App\Message::all();
});
post('api/messages', function () {
return App\Message::create(Request::all());
});
# ------------------ Password reset stuff ------------------------
// Password reset link request routes...
Route::get('password/email', 'Auth\\PasswordController@getEmail');
Route::post('password/email', 'Auth\\PasswordController@postEmail');
// Password reset routes...
Route::get('password/reset/{token}', 'Auth\\PasswordController@getReset');
Route::post('password/reset', 'Auth\\PasswordController@postReset');
# ------------------admin info stuff (建设中)------------------------
// Route::resource('info','InfoController');
// get('info', function() {
// return view('guestbook/guestbook');
示例8: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$data['messages'] = Message::all();
$data['showCreateMessage'] = true;
return \View::make('messages.index')->with($data);
}
示例9: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$message = Message::all();
return view('pages.home')->with('message', $message);
}
示例10: all
/**
* View all messages
*
* @return \Illuminate\Database\Eloquent\Collection|static[]
*/
public function all()
{
$messages = Message::all();
return $messages;
}
示例11: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return response()->json(Message::all());
}
示例12: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$messages = Message::all();
return View::make('MessageBoard', ['message_view' => $messages]);
}
示例13: getUnlinkedMessages
/**
* Get Messages that are not linked to the Layout ID provided.
*
* @param \Layout ID
*/
public function getUnlinkedMessages($elementId)
{
//$unlinkedMessages = Message::all();
//return $unlinkedMessages;
//Find all elements related to a Layout
$linkedMessages = ElementsController::getMessages($elementId);
//Get the messages that are related to id
$linkedMessagesId = $linkedMessages->lists('id');
if (count($linkedMessagesId) == 0) {
//If there is no related elements, return all available elements.
return Message::all();
} else {
//If there is related elements, find the ones that are not related
return Message::whereNotIn('id', $linkedMessagesId)->get();
}
}
示例14: senderRequest
public function senderRequest()
{
$senders = Sender::all();
$receivers = Receiver::all();
$messages = Message::all();
foreach ($senders as $sender) {
$pk_sender = $sender->private_key;
}
foreach ($receivers as $receiver) {
$pk_receiver = $receiver->private_key;
}
foreach ($messages as $message) {
$v = $message->text_message;
}
$str = "";
$len = strlen($v);
for ($y = 0; $y < $len; $y++) {
$swap = 0;
if ($v[$y] == 'A' || $v[$y] == 'a') {
$swap = 1;
}
if ($v[$y] == 'B' || $v[$y] == 'b') {
$swap = 2;
}
if ($v[$y] == 'C' || $v[$y] == 'c') {
$swap = 3;
}
if ($v[$y] == 'D' || $v[$y] == 'd') {
$swap = 4;
}
if ($v[$y] == 'E' || $v[$y] == 'e') {
$swap = 5;
}
if ($v[$y] == 'F' || $v[$y] == 'f') {
$swap = 6;
}
if ($v[$y] == 'G' || $v[$y] == 'g') {
$swap = 7;
}
if ($v[$y] == 'H' || $v[$y] == 'h') {
$swap = 8;
}
if ($v[$y] == 'I' || $v[$y] == 'i') {
$swap = 9;
}
if ($v[$y] == 'J' || $v[$y] == 'j') {
$swap = 10;
}
if ($v[$y] == 'K' || $v[$y] == 'k') {
$swap = 11;
}
if ($v[$y] == 'L' || $v[$y] == 'l') {
$swap = 12;
}
if ($v[$y] == 'M' || $v[$y] == 'm') {
$swap = 13;
}
if ($v[$y] == 'N' || $v[$y] == 'n') {
$swap = 14;
}
if ($v[$y] == 'O' || $v[$y] == 'o') {
$swap = 15;
}
if ($v[$y] == 'P' || $v[$y] == 'p') {
$swap = 16;
}
$m = $swap;
$r = $pk_sender;
$s = $pk_receiver;
$r1 = pow(3, $r) % 17;
$s1 = pow(3, $s) % 17;
$r2 = pow($s1, $r) % 17;
$s2 = pow($r1, $s) % 17;
$c = $r2 * $m % 17;
if ($c == 1) {
$str = $str . "A";
}
if ($c == 2) {
$str = $str . "B";
}
if ($c == 3) {
$str = $str . "C";
}
if ($c == 4) {
$str = $str . "D";
}
if ($c == 5) {
$str = $str . "E";
}
if ($c == 6) {
$str = $str . "F";
}
if ($c == 7) {
$str = $str . "G";
}
if ($c == 8) {
$str = $str . "H";
}
if ($c == 9) {
$str = $str . "I";
//.........这里部分代码省略.........
示例15: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$messages = Message::all();
return view('admin.inbox', compact('messages'));
}