Using Pusher with Laravel 5.8 to send messages in real-time generates this error on NewMessage Event file. Steps I took to try and debug:
tried removing the line "use Dispatchable, InteractsWithSockets, SerializesModels;" inside the Class;
tried without using the Classes at the top of the file
none of those worked. On Laravel 5.8 Documentation they don't mention using this line inside our Event Classes, maybe it's outdated?!
File looks like this:
`
namespace StyxEminus\Events;
use StyxEminus\Message;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
class NewMessage implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public $message;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(Message $message)
{
$this->message = $message;
}
/**
* Get the channels the event should broadcast on.
*
* @return \Illuminate\Broadcasting\Channel|array
*/
public function broadcastOn()
{
return new PrivateChannel('messages.' . $this->message->to);
}
public function broadcastWith() {
return ["message" => $this->message];
}
}`
Local Server: Apache on Xampp; Operating System: W10 64bit Browser: Brave(chromium) & Chrome