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


PHP Message::create方法代碼示例

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


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

示例1: createMessageNode

 public function createMessageNode()
 {
     $input = Request::all();
     //return $input;
     $app_id = '137227';
     // App ID
     $app_key = '86b7e1c9f40657708bf4';
     // App Key
     $app_secret = '48a7047a11529259b2cc';
     // App Secret
     $pusher = new Pusher($app_key, $app_secret, $app_id);
     $data['message'] = $input[2];
     $data['uid'] = $input[0];
     $data['crid'] = $input[1];
     $formdata['uid'] = $data['uid'];
     $formdata['crid'] = $data['crid'];
     $formdata['content'] = $data['message'];
     $channel = "my" . $data['crid'];
     if ($pusher->trigger($channel, 'my_event', $data)) {
         echo 'success';
         Message::create($formdata);
     } else {
         echo 'error';
     }
     //return $input;
 }
開發者ID:prakharprateek1,項目名稱:chatapp,代碼行數:26,代碼來源:MessagesController.php

示例2: handle

 /**
  * Handle the event.
  *
  * @param  Events  $event
  * @return void
  */
 public function handle(ChatEvent $event)
 {
     $message = Message::create(['message' => $event->getMessage()]);
     //		$message->chat()->associate($event->getChat());
     $event->getChat()->messages()->save($message);
     //        echo "\n{$message->message}";
 }
開發者ID:bluecipherz,項目名稱:bczapi,代碼行數:13,代碼來源:NotifyChat.php

示例3: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     for ($i = 1; $i < 40; $i++) {
         Message::create(['user_id' => rand(1, 30), 'body' => 'text' . $i]);
     }
 }
開發者ID:shine1rainbow,項目名稱:blog,代碼行數:12,代碼來源:MessageTableSeeder.php

示例4: handle

 /**
  * Execute the command.
  *
  * @return void
  */
 public function handle()
 {
     $message = Message::create($this->data);
     $this->user->messages()->save($message);
     $this->chat->messages()->save($message);
     event(new FeedableEvent('MessagePosted', $this->user, $message, $this->chat, $this->chat->project));
     return $message;
 }
開發者ID:bluecipherz,項目名稱:bczapi,代碼行數:13,代碼來源:SendChatMessage.php

示例5: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     $userIds = DB::table('users')->where('id', '!=', 1)->lists('id');
     foreach (range(1, 25) as $index) {
         Message::create(['body' => $faker->sentence(), 'senderprofileimage' => $faker->imageUrl($width = 180, $height = 180), 'senderid' => $faker->randomElement($userIds), 'sendername' => $faker->firstName]);
     }
 }
開發者ID:talha08,項目名稱:Larasocial,代碼行數:13,代碼來源:MessagesTableSeeder.php

示例6: store

 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required', 'email' => 'required|email', 'subject' => 'required', 'message' => 'required']);
     $message = $request->all();
     $message['user_id'] = Auth::user()->id;
     Message::create($message);
     return \Redirect('/dashboard')->with(['alert-success' => 'Message Successfully Sent !']);
 }
開發者ID:omasterdesign,項目名稱:omasterdefault,代碼行數:8,代碼來源:MessageController.php

示例7: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $user = null;
     if (isset($request['message'])) {
         $user = Message::create(['message' => $request['message']]);
     }
     return json_encode(['message' => is_null($user) ? 'Failed' : 'Success']);
 }
開發者ID:bendozy,項目名稱:YouTooMuch,代碼行數:14,代碼來源:MessageController.php

示例8: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $messages = ['required' => ':attribute harus diisi.'];
     $this->validate($request, ['name' => 'required|min:3', 'hp' => 'required|min:6', 'email' => 'required', 'subject' => 'required', 'message' => 'required|max:1024'], $messages);
     flash()->success('Pesan anda telah kami terima!');
     Message::create($request->all());
     return redirect('/kontak');
 }
開發者ID:kobeuu,項目名稱:bpb-sf,代碼行數:13,代碼來源:MessagesController.php

示例9: store

 public function store(Request $request)
 {
     $validator = Validator::make($request->all(), ['creator' => 'required', 'email' => 'required', 'body' => 'required']);
     if ($validator->fails()) {
         return response()->json($validator->errors()->all(), 422);
     }
     return Message::create($request->all());
 }
開發者ID:blrik,項目名稱:CRUD-Vue-JS,代碼行數:8,代碼來源:ApiMessageController.php

示例10: storeMessage

 public function storeMessage($user, $input)
 {
     $thread = Thread::create(['subject' => $input['subject']]);
     Message::create(['thread_id' => $thread->id, 'user_id' => Auth::user()->id, 'body' => $input['message']]);
     Participant::create(['thread_id' => $thread->id, 'user_id' => Auth::user()->id, 'last_read' => new Carbon()]);
     Participant::create(['thread_id' => $thread->id, 'user_id' => $user->id, 'last_read' => new Carbon()]);
     $this->sentMessageNotification($user);
 }
開發者ID:mathewsandi,項目名稱:Practice,代碼行數:8,代碼來源:MessageRepository.php

示例11: store

 public function store(MessageRequest $request)
 {
     try {
         \App\Message::create($request->all());
         return response()->json(['errors' => 'false', 'message' => 'The project has been added!']);
     } catch (\Exception $e) {
         return response()->json(['errors' => 'true', 'message' => 'Something went wrong!']);
     }
 }
開發者ID:jasonraimondi,項目名稱:twitterclone,代碼行數:9,代碼來源:MessageController.php

示例12: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $this->validate($request, ['message' => 'required|min:2|max:300']);
     $data = $request->all();
     $data['userID'] = \Auth::id();
     $data['parentID'] = $id;
     Message::create(['message' => $data['message'], 'userID' => $data['userID'], 'parentID' => $data['parentID'], 'createdDate' => Carbon::now()]);
     return redirect('message')->with(['flash_message' => 'Your reply has been added!']);
 }
開發者ID:andreea-bucur,項目名稱:GuestBook,代碼行數:16,代碼來源:MessageController.php

示例13: contactUs

 public function contactUs(Request $request)
 {
     $rules = ['email' => 'required|email', 'subject' => 'required', 'contact' => 'required', 'message' => 'required'];
     $validator = Validator::make($request->all(), $rules);
     if ($validator->fails()) {
         return redirect()->back()->with('errors', $validator->messages());
     }
     Message::create(array_except($request->all(), ['_token']));
     return redirect('/contact-us')->withMessage('Message Sent.');
 }
開發者ID:bluecipherz,項目名稱:gl-ct,代碼行數:10,代碼來源:HomeController.php

示例14: store

 /**
  * Almacena un nuevo mensaje en nuestra tabla messages
  *
  * @param  MessageRequest  $request -> valida los campos requeridos para crear un mensaje
  * @return \Illuminate\Http\Response
  */
 public function store(MessageRequest $request)
 {
     /* $request->all()  trae la información que se ingresó en la forma   */
     /* Message::create()  crea el nuevo record y lo almacena en la tabla messages */
     Message::create($request->all());
     /* Feedback para el usuario, le indiciamos que su mensaje a sido enviados */
     Session::flash('flash_message', 'Ha enviado un mensaje');
     /* redirige a la pagina de contacto y muestra el Session::flash */
     return redirect('contact');
 }
開發者ID:jazmintinajero,項目名稱:plazaapp,代碼行數:16,代碼來源:MessageController.php

示例15: contactMe

 public function contactMe(MessageRequest $request)
 {
     $request->input('title');
     $result = \Mail::raw(Input::get('message'), function ($message) {
         $message->to('shaopeihui1@gmail.com', 'Peihui Shao')->subject('Message from ' . Input::get('email') . ', ' . Input::get('user'));
     });
     Message::create($request->all());
     //        flash()->info(        var_dump($result)); //not working
     flash()->success('Your message has been delivered and saved!');
     return Redirect::back();
 }
開發者ID:ambarsetyawan,項目名稱:laravel5-blog-1,代碼行數:11,代碼來源:MessagesController.php


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