没有将正确的对象数据发送给Pusher

时间:2017-07-26 12:21:29

标签: php laravel pusher

我不知道为什么广播活动时不包括name。但它包含在return $message
这是我的Laravel' MessageController

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->name = "Clyde Santiago"; //This it the inserted data to the object
        event(new Chat($message)); //sends `message` object to Pusher but not including the `name`
        return $message //returns `message` object including the `name`
    }
}

0 个答案:

没有答案