vue.js - Pushing data into object not working in Laravel Pusher -


after saving data database, pushed $message->user = auth::user()->name , return $message. returns right object. expecting user inserted in message.

{   "message": {     "id": 46,     "channel": 1,     "by": 1,     "body": "saddla",     "created_at": "2017-07-25 18:46:31",     "updated_at": "2017-07-25 18:46:31",     "user": "clyde santiago"   } } 

but when passing $message pusher, returns original object. not including user. here's data in debug console in pusher

{   "message": {     "id": 46,     "channel": 1,     "by": 1,     "body": "saddla",     "created_at": "2017-07-25 18:46:31",     "updated_at": "2017-07-25 18:46:31"   } } 

this messagecontroller

<?php  namespace app\http\controllers;  use illuminate\http\request; use app\message; use illuminate\support\facades\auth; use app\events\chat;  class messagecontroller extends controller {     public function create(request $request){         $message = new message;         $message->channel = $request->channel_id;         $message->by = auth::user()->id;         $message->body = $request->message;          $message->save();         $message->user = auth::user()->name;         event(new chat($message));         return $message;     } } 

this question duplicate of not sending proper object data pusher - there have answers :)


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -