本文整理汇总了PHP中app\Message类的典型用法代码示例。如果您正苦于以下问题:PHP Message类的具体用法?PHP Message怎么用?PHP Message使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Message类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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. ");
}
开发者ID:Yismen,项目名称:ruta-cj27,代码行数:14,代码来源:MessagesController.php
示例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));
}
开发者ID:GrigorAtaryan,项目名称:Social_network,代码行数:7,代码来源:MessageController.php
示例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));
}
}
}
}
}
开发者ID:viktory,项目名称:chat,代码行数:27,代码来源:Chat.php
示例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');
}
开发者ID:Chiene,项目名称:Laravel_basic_tutorial,代码行数:14,代码来源:MessageBoardController.php
示例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();
}
开发者ID:jrafaelca,项目名称:infrea,代码行数:14,代码来源:MessagesController.php
示例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.");
}
开发者ID:ouracademy,项目名称:csc_company,代码行数:8,代码来源:ContactController.php
示例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!']);
}
}
开发者ID:jasonraimondi,项目名称:twitterclone,代码行数:9,代码来源:MessageController.php
示例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;
}
开发者ID:Dualse,项目名称:GitterBot,代码行数:14,代码来源:InlineDataMiddleware.php
示例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'));
}
开发者ID:Yismen,项目名称:solpieles,代码行数:10,代码来源:HomeController.php
示例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();
}
开发者ID:jamiehoward,项目名称:scavenger,代码行数:11,代码来源:MessageController.php
示例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');
}
开发者ID:benjaminsweetnam247,项目名称:Laravel-Blog-Portfolio,代码行数:17,代码来源:MailController.php
示例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');
}
开发者ID:Rogerz-sh,项目名称:Giewoo,代码行数:12,代码来源:SiteController.php
示例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');
}
开发者ID:BrambleBeard,项目名称:app,代码行数:18,代码来源:PagesController.php
示例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);
}
开发者ID:sagaekakristi,项目名称:ppla02,代码行数:18,代码来源:MessagingController.php
示例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();
}
开发者ID:kritishpahi,项目名称:SoftwareEngineering,代码行数:13,代码来源:UC.php
示例16: 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
示例17: handle
/**
* @param Message $message
* @return mixed
*/
public function handle(Message $message)
{
$text = $message->escaped_text;
if (preg_match('/^(?:select|update|delete|drop|insert)/iu', $text)) {
try {
$builder = new BuilderClass($text);
$message->code($builder->convert(), 'php');
return null;
} catch (\Exception $e) {
$message->pre('SQL Builder error: ' . $e->getMessage());
}
}
return $message;
}
开发者ID:Dualse,项目名称:GitterBot,代码行数:18,代码来源:SqlBuilderMiddleware.php
示例18: postChat
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function postChat(Request $request)
{
$data = array('type' => 'chat', 'message' => $request['messageChat'], 'author' => \Auth::user()->name . ' ' . \Auth::user()->surname, 'dest' => $request['to'], 'origin' => \Auth::user()->id);
event(new MyEventNameHere($data));
$message = new Message();
$message->from = \Auth::user()->id;
$message->to = $request['to'];
$message->message = $request['messageChat'];
$message->active = 1;
$message->online = 1;
$message->save();
$response['result'] = "success";
$response['dest'] = $request['to'];
return $response;
}
开发者ID:elieishimwe,项目名称:Siyaleader-Transnet,代码行数:20,代码来源:ChatController.php
示例19: handle
/**
* @param Message $message
* @return mixed
*/
public function handle(Message $message)
{
$text = $message->escaped_text;
if (preg_match('/^(@.*?\\s)?(?:оформи\\sкод|код\\sоформи).*?$/isu', $text)) {
$hasMentions = count($message->mentions);
$mention = null;
if ($hasMentions) {
$mention = $message->mentions[0]->login === \Auth::user()->login ? $message->user : $message->mentions[0];
}
$answer = $mention ? \Lang::get('markdown.personal', ['user' => $mention->login]) : \Lang::get('markdown.common');
$message->italic($answer);
return null;
}
return $message;
}
开发者ID:Director-cemetery,项目名称:GitterBot,代码行数:19,代码来源:MarkdownAdviserMiddleware.php
示例20: deleteMessage
public function deleteMessage(Request $request, Message $message)
{
$result = $message->delete();
if ($result) {
if ($request->isXmlHttpRequest()) {
return ['success' => true];
}
Flash::info('Message ' . $message->id . ' removed.');
return redirect()->back();
}
if ($request->isXmlHttpRequest()) {
return ['success' => false, 'message' => 'Can\'t remove message ' . $message->id];
}
return redirect()->back()->withErrors(['Can\'t remove message ' . $message->id]);
}
开发者ID:paulchyrilov,项目名称:hello_laravel,代码行数:15,代码来源:AdminController.php
注:本文中的app\Message类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论