本文整理汇总了PHP中app\Message类的典型用法代码示例。如果您正苦于以下问题:PHP Message类的具体用法?PHP Message怎么用?PHP Message使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Message类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Message $message)
{
$toggle = $message->viewed ? 0 : 1;
$message->viewed = $toggle;
$message->save();
return redirect()->route('admin.messages.index')->withSuccess("The Message [{$message->message}] has been marked as viewed. ");
}
示例2: update_messages
public function update_messages()
{
$from_id = Auth::User()->id;
$message = new Message();
$new_msg = $message->get_new_messages($from_id);
echo json_encode(array('new_msg' => $new_msg));
}
示例3: createMessage
protected function createMessage($from, $msg)
{
echo sprintf('User %d sending message "%s" to user %d' . "\n", $from->userId, $msg->message, $msg->userTo);
$dialog = new Dialog();
$dialog->from = $from->userId;
$dialog->to = $msg->userTo;
if ($dialog->validate()) {
if (($existedDialog = Dialog::byUsers($dialog->from, $dialog->to)->first()) === null) {
$dialog->save();
$existedDialog = $dialog;
}
$message = new Message();
$message->from = $from->userId;
$message->dialog_id = $existedDialog->id;
$message->text = $msg->message;
if ($message->validate()) {
$message->save();
foreach ($this->clients as $client) {
if ($client->userId == $from->userId || $client->userId == $msg->userTo || $client->isAdmin === true) {
$view = view('chat._message', ['messages' => [$message], 'isAdmin' => $client->isAdmin]);
$sendData = ['action' => Message::CREATE_ACTION_NAME, 'html' => $view->render()];
$client->send(json_encode($sendData));
}
}
}
}
}
示例4: store
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
$message = new Message();
$message->name = Input::get('username');
$message->message = Input::get('message');
$message->save();
return Redirect::to('/message');
}
示例5: store
/**
* Store a newly created resource in storage.
*
* @param CreateMessageRequest $request
* @return Response
*/
public function store(CreateMessageRequest $request)
{
$message = new Message();
$message->fill($request->all());
$message->save();
Flash::info(trans('messages.message_sent_successfully'));
return redirect()->back();
}
示例6: postContact
public function postContact(ContactFormRequest $request)
{
$data = new Message($request->name, $request->email, explode("\n", $request->get('message')));
Mail::send('emails.contact', $data->toArray(), function ($message) use($data) {
$message->subject('CSC Company Formulario de contáctenos: ' . $data->name)->to(Message::ORGANIZATION_EMAIL)->replyTo($data->email);
});
return back()->withMessage("Gracias por su mensaje. Ha sido enviado.");
}
示例7: destroy
public function destroy(Message $message)
{
try {
$message->delete();
return response()->json(['errors' => 'false', 'message' => 'The project has been deleted!']);
} catch (\Exception $e) {
return response()->json(['errors' => 'true', 'message' => 'Something went wrong!']);
}
}
示例8: handle
/**
* @param Message $message
* @return mixed
*/
public function handle(Message $message)
{
$isImage = preg_match('/[^`]http(?:s)?:\\/\\/.*?\\.(?:jpg|png|jpeg|svg|bmp)/iu', ' ' . $message->text);
$isVideo = preg_match('/[^`]http(?:s)?:\\/\\/(?:www\\.)?(?:youtube\\.com|youtu\\.be).*?/iu', ' ' . $message->text);
if (($isImage || $isVideo) && $message->user->login !== \Auth::user()->login) {
$answer = \Lang::get('gitter.inline', ['user' => $message->user->login]);
$message->italic($answer);
}
return $message;
}
示例9: dashboard
public function dashboard(Request $request, User $user, Role $roles, Message $messages)
{
$user = Auth::user();
$user->usersCount = $user->all()->count();
$user->rolesCount = $roles->all()->count();
$user->contactsCount = $user->contacts()->count();
$user->todosCount = $user->todos()->whereDone(0)->count();
$user->messagesCount = $messages->whereViewed(0)->count();
return view('dashboard.index', compact('user'));
}
示例10: createAdmin
public function createAdmin(Request $request)
{
$this->validate($request, ['recipient' => 'required', 'content' => 'required']);
$message = new Message();
$message->sender_id = 1;
$message->recipient_id = $request->input('recipient');
$message->content = $request->input('content');
$message->read = 0;
$message->save();
return $this->response();
}
示例11: store
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
$mail = new Message();
$mail->sender = $request->name;
$mail->email = $request->email;
$mail->subject = $request->subject;
$mail->message = $request->message;
$mail->save();
\Session::flash('flash_message', 'Message Sent');
return redirect('contact.create');
}
示例12: postCreateMessage
public function postCreateMessage()
{
$msg = request()->input('message');
$message = new Message();
foreach ($msg as $key => $value) {
$message->{$key} = $value;
}
$message->save();
return response($message->id);
// DB::insert('insert into messages (name, tel, email, type, created_at, updated_at) values (?, ?, ?, ?, ?, ?)', [$msg->name, $msg->tel, $msg->type, getdate(), getdate()]);
// return response('1');
}
示例13: storeContact
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function storeContact(Request $request)
{
$message = new Message();
$message->first = $request->first;
$message->last = $request->last;
$message->email = $request->email;
$message->subject = $request->subject;
$message->message = $request->message;
$message->save();
session()->flash('flash_success', 'Thank you for your message.');
return redirect()->route('home');
}
示例14: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
// store
$new_message = new Message();
$new_message->sender_user_id = Input::get('from_id');
$new_message->receiver_user_id = Input::get('to_id');
$new_message->message_content = Input::get('message');
$new_message->save();
// redirect
//Session::flash('message', 'Successfully created job!');
return Redirect::to('message/' . $new_message->receiver_user_id);
}
示例15: messagesave
public function messagesave($id, Request $req)
{
$s = new Message();
$s->id = $req['id'];
$s->message = $req['message'];
$s->sender = $req['sender'];
$s->contact = $req['contact'];
//$stu->head=$s->head;
//$stu->body=$s->body;
//$stu->save();
$s->save();
return back();
}