当前位置: 首页>>代码示例>>PHP>>正文


PHP Message::where方法代码示例

本文整理汇总了PHP中app\Message::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::where方法的具体用法?PHP Message::where怎么用?PHP Message::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Message的用法示例。


在下文中一共展示了Message::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: refresh

 public function refresh()
 {
     $count = Message::where('id_receive', \Auth::user()->id)->where('read', NULL)->count();
     if ($count) {
         return $count;
     }
 }
开发者ID:zluy4yvak,项目名称:chat,代码行数:7,代码来源:HomeController.php

示例2: index

 /**
  * Despliega el listado de mensajes nuevos
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     /* Selecciona los mensajes que no han sido vistos del mas reciente al mas antiguo*/
     $messages = Message::where('seen', '=', 'false')->latest()->get();
     /* retorna vista con los mensajes que no han sido vistos */
     return view('adminmessages.index')->with('messages', $messages);
 }
开发者ID:angelsalazar,项目名称:plazaapp,代码行数:12,代码来源:AdminMessageController.php

示例3: getConversation

 public function getConversation($id)
 {
     $_messages = Message::where(['conversation_id' => $id])->orderBy('updated_at', 'desc')->get();
     $_conversation = Conversation::find($id);
     $messages = collect();
     foreach ($_messages as $_message) {
         $sender = User::find($_message->author_id);
         $message = array();
         $message['author_id'] = $_message->author_id;
         $message['body'] = $_message->body;
         $message['author_name'] = $sender->name;
         $message['author_surname'] = $sender->surname;
         $message['timestamp'] = $sender->updated_at;
         $messages->push($message);
     }
     $conversation_name = "";
     if ($_conversation->title == "") {
         $conversation_name = ConversationsController::getUsersString($id);
         $_conversation->save();
     } else {
         $conversation_name = $_conversation->title;
     }
     $user = User::find(Auth::id());
     $unreadNotifications = $user->notifications()->unread()->get()->count();
     $notifications = $user->notifications()->get();
     return view('conversations.conversation')->with(['messages' => $messages, 'conversation_name' => $conversation_name, 'id' => $id, 'new_notifications_count' => $user->notifications()->unread()->not_type('message')->get()->count(), 'notifications' => $user->notifications()->not_type('message')->get(), 'new_messagesNotifications_count' => $user->notifications()->unread()->type('message')->get()->count(), 'messagesNotifications' => $user->notifications()->type('message')->get()]);
 }
开发者ID:eldorplus,项目名称:laravel5.1_social_network,代码行数:27,代码来源:ConversationsController.php

示例4: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     if (!Auth::check()) {
         return Redirect::to('/login');
     }
     $messages = Message::where('receiver_id', Auth::user()->id)->orderBy('created_at', 'desc')->get();
     return view('inbox', ['messages' => $messages]);
 }
开发者ID:smckeehan,项目名称:confr,代码行数:13,代码来源:MessagesController.php

示例5: show

 public function show(Request $request, $user)
 {
     $messages = Message::where(['from' => Auth::user()->id, 'to' => $user])->orWhere(['to' => Auth::user()->id, 'from' => $user])->orderBy('id', 'DESC')->paginate(30);
     $messages = $this->sortMessages($messages);
     $data['messages'] = $messages;
     $data['receiver'] = $user;
     return view('messages.show', $data);
 }
开发者ID:phumaster,项目名称:uploadImage,代码行数:8,代码来源:MessageController.php

示例6: show

 public function show($id)
 {
     (new Message())->readOpenMessage($id);
     $messages = Message::where('dialog_id', $id)->orderBy('created_at', 'desc')->get();
     $user_id = Dialog::where('total', $id)->where('user_id', '!=', \Auth::user()->id)->first()->user_id;
     $sender = User::find($user_id);
     return view('show', ['messages' => $messages, 'sender' => $sender, 'id' => $id]);
 }
开发者ID:zluy4yvak,项目名称:chat,代码行数:8,代码来源:MessagesController.php

示例7: dashboard

 /**
  * Despliega la interfaz para el dashboard
  *
  * @return \Illuminate\Http\Response
  */
 public function dashboard()
 {
     /* Selecciona todos los mensajes de la tabla messages que no han sido vistos */
     $newMgs = Message::where('seen', '=', 'false')->get();
     /* Obtiene el número de mensajes que no han sido vistos */
     $quantity = count($newMgs);
     /* retorno la vista del dashboard, con el número de mensajes nuevos */
     return view('pages.dashboard')->with('quantity', $quantity);
 }
开发者ID:jazmintinajero,项目名称:plazaapp,代码行数:14,代码来源:AdminDashboardController.php

示例8: getSend

 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function getSend(User $user)
 {
     $this->authorize('sendMessage', $user);
     $readMessages = Message::where('receiver_id', \Auth::user()->id)->where('user_id', $user->id)->where('type', false)->orderBy('created_at', 'desc')->get();
     foreach ($readMessages as $message) {
         $message->is_read = true;
         $message->save();
     }
     $messages = Message::where('receiver_id', \Auth::user()->id)->where('user_id', $user->id)->where('type', false)->orderBy('created_at', 'desc')->paginate(3);
     return view('message.send', compact('user', 'messages'));
 }
开发者ID:Ravend6,项目名称:laravel_base_v5.2,代码行数:16,代码来源:MessageController.php

示例9: searchTickets

 public function searchTickets()
 {
     //str replace to fix an edge case - a user wants to search for a literal %
     $query = str_replace('%', '\\%', Input::get('query'));
     //collect tickets from various places matched by the search
     $tickets = Ticket::where('subject', 'like', "%{$query}%")->get()->merge(Message::where('text', 'like', "%{$query}%")->get()->map(function ($message) {
         return $message->ticket;
     }))->unique()->filter(function ($ticket) {
         return Gate::allows('view-ticket', $ticket);
     });
     return view("helpdesk/searchResults", compact('tickets'));
 }
开发者ID:noikiy,项目名称:Laravel-5-Helpdesk,代码行数:12,代码来源:HelpDeskController.php

示例10: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     // get all the message for this user
     $logged_user_id = Auth::user()->id;
     $messages = Message::where('receiver_user_id', $logged_user_id)->get();
     $query = "SELECT m.id, m.sender_user_id, m.receiver_user_id, m.message_content, m.created_at, u.name ";
     $query .= "FROM message m, users u ";
     $query .= "WHERE receiver_user_id = " . $logged_user_id . " and u.id = m.sender_user_id ";
     $query .= "ORDER BY created_at DESC ";
     $messages = DB::select(DB::raw($query));
     // load the view and pass the jobs
     return View::make('messaging.index')->with('messages', $messages);
 }
开发者ID:sagaekakristi,项目名称:ppla02,代码行数:18,代码来源:MessagingController.php

示例11: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $book = Book::findorFail($id);
     $message = Message::where('book_id', '=', $id)->take(10)->get();
     if (!Auth::check()) {
         $user_id = 1;
     } else {
         $user_id = Auth::user()->id;
     }
     if (is_null($book)) {
         abort(404);
     }
     return view('books.show', compact('book', 'user_id', 'message'));
 }
开发者ID:maherelgamil,项目名称:Small-store-for-books-with-Laravel-5.1,代码行数:20,代码来源:BooksController.php

示例12: save

 /**
  * Add/Edit the message.
  * 
  * @param number $id
  * @return number
  */
 public function save($id)
 {
     $person = Request::input('person');
     $text = Request::input('message');
     if ($id == 0) {
         $message = new Message();
         $message->person = $person;
         $message->message = $text;
         return (int) $message->save();
     } else {
         return (int) Message::where('id', $id)->update(array('message' => $text));
     }
     return 0;
 }
开发者ID:somkiatprogrammer,项目名称:backbone-simplechat,代码行数:20,代码来源:ChatController.php

示例13: hasNewMessages

 private function hasNewMessages()
 {
     $messages = Message::where(['to' => Auth::user()->id, 'read' => 0])->get();
     if ($messages->count() <= 0) {
         return false;
     } else {
         foreach ($messages as $message) {
             $message->update(['read' => 1]);
             $u = $message->user()->first();
             $avatar = $u->getProfilePictureUrl();
             $data[] = array_merge($message->toArray(), ['user' => $u->toArray(), 'xhr' => route('message', $u['id']), 'avatar_url' => $avatar]);
         }
         $this->messages = $data;
         return true;
     }
 }
开发者ID:phumaster,项目名称:uploadImage,代码行数:16,代码来源:PullRequestController.php

示例14: boot

 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     \Carbon\Carbon::setLocale('zh');
     //默认'en'
     View()->composer('*', function ($view) {
         $navMessages = Message::where(['isread' => 0])->get();
         $type0 = Message::where(['isread' => 0, 'type' => 0])->count();
         $type1 = Message::where(['isread' => 0, 'type' => 1])->count();
         $type2 = Message::where(['isread' => 0, 'type' => 2])->count();
         $type3 = Message::where(['isread' => 0, 'type' => 3])->count();
         view()->share('navMessages', $navMessages);
         view()->share('type0', $type0);
         view()->share('type1', $type1);
         view()->share('type2', $type2);
         view()->share('type3', $type3);
     });
 }
开发者ID:Panfen,项目名称:mango,代码行数:22,代码来源:AppServiceProvider.php

示例15: __construct

 public function __construct()
 {
     /*Licznik zmian, który zmienia się po 24h od dodania zmiany*/
     $date = Carbon::now();
     $date->modify('-24 hours');
     $formatted_date = $date->format('Y-m-d H:i:s');
     $countchange = Change::where('created_at', '>', $formatted_date)->count();
     /*Licznik graczy Online na serwerze*/
     $countonline = Player::where('online', '=', 1)->count();
     /*Licznik niedoczytanych wiadomości prywatnych*/
     $notread1 = Message::where('to_user_id', \Auth::id())->where('read', 0)->count();
     if (\Auth::check()) {
         Cache::remember('users', 5, function () {
             return User::where('id', \Auth::id())->update(['last_activity' => Carbon::now()]);
         });
     }
     /*Licznik i skrypt usuwający i nadający banicję za 4 ostrzeżenia na stronie*/
     $countcautions = Caution::where('user_id', \Auth::id())->count();
     if (!\Auth::guest() && $countcautions == 4) {
         $user = User::where('id', \Auth::id())->first();
         $g = array(4);
         $user->update(['banned' => 'Zbanowany za 4 ostrzeżenia na stronie']);
         $user->group()->sync($g);
     }
     $deleteCaution = Caution::where('user_id', \Auth::id())->where('created_at', '<=', Carbon::now()->subDays(14));
     $deleteCaution->delete();
     $section = Section::lists('name', 'id');
     $lives = Live::latest('created_at')->take(5)->get();
     if (!\Auth::guest()) {
         $notifications = \Auth::user()->notification()->latest('created_at')->take(10)->get();
         View::share('notifications', $notifications);
     }
     View::share('countchange', $countchange);
     View::share('countonline', $countonline);
     View::share('notread1', $notread1);
     View::share('section', $section);
     View::share('lives', $lives);
     $this->middleware('banned', ['except' => ['auth']]);
 }
开发者ID:AdrianKuriata,项目名称:projekt,代码行数:39,代码来源:Controller.php


注:本文中的app\Message::where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。