Category : events

The below controller function triggers both retrieved & created events of observer. I’m not getting why this happens. I want only the created event to trigger when the insertion given in the controller happens. Any helps to solve this is much appreciated. Controller public function insert(Request $request) { $validator = Validator::make( $request->all(), [ ‘orderId’ => ..

Read more

I have an problem. I created ResponseReceived listener to log some info, but I need understand where this event was dispatched. As I can see I don’t have context in event. It will be perfect to get access to parent Request or App intstance. Did somebody has similar problem and how to resolve this? I ..

Read more

I’m trying to trigger some action after create and update my model following Laravel docs regarding events and observers. So I have: AppObserversPedidoObserver.php: <?php namespace AppObservers; use AppPedido; use IlluminateSupportFacadesLog; class PedidoObserver { public $afterCommit = true; public function created(Pedido $pedido) { Log::info(‘A new order has been created and the properly method has been triggered’); ..

Read more

<select wire:change="selectOrder($event.target.value)"> @foreach($orders as $option) <option value="{{$option[‘id’]}}">{{$option[‘id’]}}</option> @endforeach </select> public function selectOrder($order) { $this->order = $order; $this->products = $this->order->products; } here is a live wire component that has a select input I need when changing the select the function selectOrder is executed with the selected value, i use $event magic action but i got the ..

Read more

when I trigger an event, the channel it’s being broadcasted on is getting this format of response: {"channel":"events","event":"AppEventsRealTimeMessage","data":"{"message":"a","channel":"events"}"} I can change the data part from broadcastWith and the previous output will look like this: {"channel":"events","event":"AppEventsRealTimeMessage","data":"{"a"}"} the code is: public function broadcastWith(){ return [$this->message]; } But I want the response to be like this: "a". Source: ..

Read more

I have an issue with Laravel Pusher events first of all when I fire the event from the pusher debug console it works fine But when I try to do it from my laravel controllers, it doesn’t. and here is my code my event class FileAdded implements ShouldBroadcast { use Dispatchable, InteractsWithSockets, SerializesModels; /** * ..

Read more

Did my research and found nothing about this topic. In the docs: https://mailchimp.com/developer/marketing/guides/track-outside-activity-events/#create-an-event Apparently said how to create an event with options, using the library that they said which in PHP is: composer require mailchimp/transactional I can ping, do all the simple requests without problem but some options for events are not even avaliable, for ..

Read more

I need to send the response from a channel to the sender socket when an event from backend is invoked. Right it successfully broadcasts to all other sockets but not the sender. How can I achieve this? socket.js ‘use strict’; var cors = require(‘cors’); var app = require(‘express’)(); app.use(cors({origin: ‘*’})); var server = require(‘http’).Server(app); var ..

Read more

I am passing an array to an event and I am updating the array in the listeners. But I am not getting back the updated array after the event. This is where I am calling the event: $roles_permissions = ["val1"]; event(new SeedingRolesPermissions($roles_permissions)); var_dump($roles_permissions); This is the event class’s constructor code: public $roles_permissions; public function __construct($roles_permissions) ..

Read more

I am writing tests for my Laravel project. Right now I am testing the authentication code like login, logout, reset password and so on. Sadly, my test is failing because there is no notification send. I have mocked the notifications but assertSendTo always fails with the reason The expected [IlluminateAuthNotificationsResetPassword] notification was not sent.. However, ..

Read more

I am writing tests for my Laravel project. Right now I am testing the authentication code like login, logout, reset password and so on. Sadly, my test is failing because there is no notification send. I have mocked the notifications but assertSendTo always fails with the reason The expected [IlluminateAuthNotificationsResetPassword] notification was not sent.. However, ..

Read more