Php 未经认证的Laravel推进器
这就是我的活动Php 未经认证的Laravel推进器,php,laravel,echo,pusher,Php,Laravel,Echo,Pusher,这就是我的活动 $post = Post::create([ 'title' => $request->title, 'body' => $request->body, 'user_id' => auth()->id(), ]); event(new PostPublished($post)); 此方法的路径是 Auth::routes(); Route::post('p
$post = Post::create([
'title' => $request->title,
'body' => $request->body,
'user_id' => auth()->id(),
]);
event(new PostPublished($post));
此方法的路径是
Auth::routes();
Route::post('posts', [App\Http\Controllers\HomeController::class, 'storePost'])->name('posts.store');
在我的活动中,我就是这样调用broadcastOn()
public function broadcastOn()
{
return new Channel('post');
}
在我的channels.php
Broadcast::channel('post', function () {
return true;
}, ['guards' => ['web']]);
现在我在我的组件中做这个
Echo.channel(`post`).listen("PostPublished", (post) => {
Notification.requestPermission((permission) => {
let notification = new Notification("Congrats on new Post", {
body: post.title,
icon: "https://pusher.com/static_logos/320x320.png",
});
notification.onclick = () => {
window.open(window.location.href);
};
});
});
但是它给我带来了错误它带来了什么样的错误?