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