Answer the question
In order to leave comments, you need to log in
What's wrong with Array to String?
I create an event, I suppose there is a syntax error, but I do it clearly according to the documentation, what's the problem?
<?php
namespace App\Events;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
class UpdateItem implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
protected $item;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($item)
{
$this->item = $item;
}
/**
* Get the channels the event should broadcast on.
*
* @return \Illuminate\Broadcasting\Channel|array
*/
public function broadcastOn()
{
return new PrivateChannel('public');
}
public function broadcastAs()
{
return ['UpdateItem'];
}
}
event(new UpdateItem(json_encode($slot)));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question