當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Message::find方法代碼示例

本文整理匯總了PHP中app\Message::find方法的典型用法代碼示例。如果您正苦於以下問題:PHP Message::find方法的具體用法?PHP Message::find怎麽用?PHP Message::find使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Message的用法示例。


在下文中一共展示了Message::find方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: markAsRead

 public function markAsRead($id)
 {
     $message = Message::find($id);
     $message->read = 1;
     $message->save();
     return $this->response();
 }
開發者ID:jamiehoward,項目名稱:scavenger,代碼行數:7,代碼來源:MessageController.php

示例2: setMessageOpened

 /**
  * Sets a user's message to opened.
  * @since 0.1.0
  */
 public function setMessageOpened($id)
 {
     $message = Message::find($id);
     $message->opened = true;
     $message->save();
     return $message;
 }
開發者ID:jonpemby,項目名稱:calorie,代碼行數:11,代碼來源:ServicesController.php

示例3: destroy

 public function destroy($id)
 {
     $message = Message::find($id);
     if (count($message) > 0) {
         return Message::destroy($id);
     }
     abort(204);
 }
開發者ID:blrik,項目名稱:CRUD-Vue-JS,代碼行數:8,代碼來源:ApiMessageController.php

示例4: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $message = Message::find($id);
     if (count($message) > 0) {
         return response()->json($message);
     }
     abort(204);
 }
開發者ID:danielmoracr,項目名稱:wall-vuejs-laravel,代碼行數:14,代碼來源:MessagesController.php

示例5: send

 /**
  * Send an email with the saved message.
  *
  * @param   $id
  * @return Response
  */
 public function send($id)
 {
     $payload = Message::find($id);
     $data = array('email' => $payload->email, 'name' => $payload->name, 'content' => $payload->message);
     Mail::send('notifications.herpakken', $data, function ($message) use($data) {
         $message->to($data['email'], $data['name'])->from('info@herpakken.be')->subject('Tijd om je te herpakken!');
     });
 }
開發者ID:janhenckens,項目名稱:herpakken,代碼行數:14,代碼來源:MessageController.php

示例6: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $message = Message::find($id);
     if (is_null($message)) {
         return response()->json(["status" => "Mensagem não encontrada"], 400);
     }
     $message->delete();
     return response()->json($message);
 }
開發者ID:williamfunchal,項目名稱:SocialBaseTest,代碼行數:15,代碼來源:MessagesController.php

示例7: changeSubject

 /**
  * @param         $message_id
  * @param Request $request
  *
  * @return mixed
  * @throws NotFoundException
  */
 public function changeSubject($message_id, Request $request)
 {
     $this->validate($request, ['subject' => 'required']);
     if ($message = Message::find($message_id)) {
         $message->update($request->get('subject'));
         return $this->respondSuccess('Subject successfully updated', ['message' => Fractal::item($message, new MessageTransformer())]);
     }
     throw new NotFoundException();
 }
開發者ID:LPVua,項目名稱:messangerApi,代碼行數:16,代碼來源:MessagesController.php

示例8: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $message = Message::find($request->route()->getParameter('id'));
     if ($message) {
         $message->read = 1;
         $message->save();
     }
     return $next($request);
 }
開發者ID:otsaan,項目名稱:e-blog,代碼行數:16,代碼來源:Read.php

示例9: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $msgObj = Message::find($id);
     $msgObj->read = 1;
     $msgObj->save();
     $data = array('type' => 'noreadprivatemsg', 'dest' => $msgObj->to);
     event(new MyEventNameHere($data));
     $sender = User::find($msgObj->from);
     return view('messages.detail', compact('msgObj', 'sender'));
 }
開發者ID:elieishimwe,項目名稱:Siyaleader-Transnet,代碼行數:16,代碼來源:MessageController.php

示例10: comments

 /**
  * 評論
  * @return bool
  */
 public function comments(Request $request)
 {
     $comment = new Comment();
     $comment->content = $request->content;
     $comment->message_id = $request->message_id;
     $comment->user_id = Auth::id();
     $comment->message_user_id = Message::find($request->message_id)['user_id'];
     $comment->save();
     return Redirect('/message_info' . '/' . $request->message_id);
 }
開發者ID:babyanzichen,項目名稱:--laravel5-----,代碼行數:14,代碼來源:MessageController.php

示例11: update

 /**
  * Actualiza la formación de un mensaje es específico
  *
  * @param  MessageRequest  $request -> valida los campos requeridos para actualizar un mensaje
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(MessageRequest $request, $id)
 {
     /* encuentra el mensaje basado en su id (select * from messages where id = $id) */
     $message = Message::find($id);
     /* $request->all() trae todos los datos que fueron ingresados en la forma */
     /* $message->fill() Actualiza sólo los campos que se encuentran en $request->all() */
     $message->fill($request->all());
     /* guarda los cambios */
     $message->save();
     /* retorno a el listado de mensajes */
     return redirect('msgs');
 }
開發者ID:angelsalazar,項目名稱:plazaapp,代碼行數:19,代碼來源:AdminMessageController.php

示例12: viewMessage

 public function viewMessage($id)
 {
     $message = Message::find($id);
     if (!Auth::check()) {
         return Redirect::to('/login');
     } else {
         if (Auth::user()->id != $message->receiver_id) {
             return Redirect::to('/inbox');
         }
     }
     DB::table('messages')->where('id', $id)->update(['read' => true]);
     return view('message', ['message' => $message]);
 }
開發者ID:smckeehan,項目名稱:confr,代碼行數:13,代碼來源:MessagesController.php

示例13: chat

 public function chat()
 {
     $receiverId = Input::get('receiver');
     DB::beginTransaction();
     $message = Message::create(['sender' => Session::get(MateMiddleware::$VERIFY), 'receiver' => $receiverId, 'content' => Input::get('content')]);
     $mate = Mate::find($receiverId);
     $mate->inform = true;
     $mate->save();
     DB::commit();
     $result = Message::find($message->id);
     //$result = ['id'=>$message->id, 'sender'=>$message->sender, 'receiver'=>$message->receiver, 'content'=>$message->content, 'edit'=>$message->edit];
     return $result;
 }
開發者ID:panboxiaosa,項目名稱:passer,代碼行數:13,代碼來源:MessageController.php

示例14: onMessage

 public function onMessage(ConnectionInterface $from, $msg)
 {
     $msg = json_decode($msg);
     if (isset($msg->action)) {
         if ($msg->action == Message::CREATE_ACTION_NAME) {
             $this->createMessage($from, $msg);
         } elseif (isset($msg->id) && $msg->action == Message::DELETE_ACTION_NAME) {
             if (($message = Message::find($msg->id)) !== null) {
                 $this->deleteMessage($message);
             }
         }
     }
 }
開發者ID:viktory,項目名稱:chat,代碼行數:13,代碼來源:Chat.php

示例15: deleteMessage

 /**
  * Remove message from Discussion
  *
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function deleteMessage()
 {
     $input = Input::all();
     $message = Message::find($input['delete']);
     if (!is_null($message->attachment)) {
         $image = 'uploads/projects/' . $message->attachment;
         $thumbnail = 'uploads/projects/thumbnails/' . $message->attachment;
         if (file_exists($image)) {
             unlink($image);
         }
         if (file_exists($thumbnail)) {
             unlink($thumbnail);
         }
     }
     $message->delete();
     return redirect('/projects/discussion');
 }
開發者ID:AlexAustralia,項目名稱:printflow,代碼行數:22,代碼來源:ProjectsController.php


注:本文中的app\Message::find方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。