I´m trying to send a push notification in Laravel. I´m using pusher but there is an error.
route.web
Route::get('push', function () {
event(new App\Events\MessageToProveedor("Welcome"));
return "Event has been sent!";
})->name('push');
MessageToProveedor's file
public $username;
public $message;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($username)
{
$this->username = $username;
$this->message = "liked your status";
}
/**
* Get the channels the event should broadcast on.
*
* @return \Illuminate\Broadcasting\Channel|array
*/
public function broadcastOn()
{
//channel
return ['my-channel'];
}
public function broadcastAs()
{
//event
return 'my-event';
}
When I execute de route /push return an error in Pusher.php plugin.
ErrorException array_merge(): Argument #2 is not an array
Failing line $all_params = array_merge($post_params,$params);
$params is null
Are you using Laravel v8.29.0? This should be resolved in that release.