当前位置: 首页>>代码示例>>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;未经允许,请勿转载。