Questions tagged [laravel-events]

Laravel's events provides a simple observer implementation, allowing you to subscribe and listen for events in your application.

Laravel's events provides a simple observer implementation, allowing you to subscribe and listen for events in your application.

Event classes are typically stored in the app/Events directory, while their listeners are stored in app/Listeners.

114 questions
1
vote
1 answer

Sharing events between two Laravel applications

Is it possible to have one Laravel application listen for events triggered in another? I've built a REST API to complement an existing web app. It uses the same database but I've built it as a separate application and there are certain events which…
Matthew Daly
  • 9,212
  • 2
  • 42
  • 83
1
vote
1 answer

Laravel events not firing?

I can't seem to get any of my eloquent.saved event handlers to run. I tried this:
mpen
  • 272,448
  • 266
  • 850
  • 1,236
1
vote
1 answer

Laravel - eloquent.saved event for model is not getting fired

Issue description I have been trying to get captainhook to work for a model and was not able to do so. Captainhook is a php library that let's adding URLs and eloquent or custom events for sending event data to those URLs we specify based on the…
1
vote
2 answers

Deleting the children models automatically

I have three models: User has-many Post has-many Comment. When I delete a user, I want all of his related posts to automatically be deleted as well as the comments that are related to these posts. In order to achieve this, I have the following code…
Alex Lomia
  • 6,705
  • 12
  • 53
  • 87
0
votes
1 answer

Checking whether an event is finished or not in laravel

Is there any way to check if there are any pending events, from the controller? I've created two listeners for handling Stripe webhook. One for 'WebhookHandled' and another for 'WebhookReceived'. when i register a user (and subscribe / make payment…
Nadiya
  • 382
  • 1
  • 7
  • 18
0
votes
0 answers

Cannot read data that send in pusher private channel when user is connect to the pusher

The user connect to the pusher but not subscribe to private channel and the data send with the event the private channel and cannot access to it. Here is my event in Laravel: BlogCreatedEvent in Laravel Here is my channel in Laravel: channel in…
0
votes
0 answers

How to prevent Laravel Echo from receiving events sent in different urls?

I have a Laravel application that uses Echo and Pusher to provide real-time chat functionality. The application has three chat rooms: welcome, casual, and serious. All users can access these chat rooms. Currently, my chat component is set up like…
0
votes
1 answer

Laravel Supervisor - SMTP issue stopping the code even email is sending through queue

I have supervisor installed to run the code using Laravel queue in background I am using this things to send an email usually and using SMTP to send an email But whenever there is any issue with SMTP connection, my code get stopped and firing 500…
0
votes
1 answer

How to return the result from listener to the Controller

I'm working with Laravel 9 and I have called this event in my Controller method when a new user signs up and registers: $data = $request->validated(); event(new RegisterNewUserEvent($data)); $code = ActiveCode::generateCode($user); dd($code); So…
japose7523
  • 29
  • 2
  • 15
0
votes
0 answers

Broadcasting to same channel name from different events using pusher

I am using pusher as broadcast driver. My requirement is, I want to broadcast to the same channel (orders) from different events. For that I have two events OrderCreatedEvent and OrderUpdatedEvent OrderCreatedEvent class OrderCreatedEvent implements…
Ahmar Arshad
  • 477
  • 1
  • 10
  • 22
0
votes
1 answer

How to use Laravel 9 Notification Events

I am using laravel 9 queue notification. I want to see if the emails are sent successfully or not. I have read and executed the laravel documentation notification events https://laravel.com/docs/9.x/notifications#notification-events but when I run…
Mohsen
  • 260
  • 3
  • 14
0
votes
1 answer

Laravel 9 Event Queue: Illuminate\Database\Grammar::parameterize(): Argument #1 ($values) must be of type array, int given, called in Grammar.php

I'm working with Laravel 9 and for registration of my website, I tried adding this event as the register form action: $data = $request->validated(); event(new RegisterNewUserEvent($data)); And here is the RegisterNEwUserEvent: class…
japose7523
  • 29
  • 2
  • 15
0
votes
1 answer

How to use a boot() in laravel model?

I have two models and migration tables named as users and roles (for both migrations and models names). This is the first time I am using boot(). I have one doubt: if the user is successfully registered then his role should be stored automatically…
Code cracker
  • 316
  • 1
  • 5
  • 20
0
votes
1 answer

How to show alert message in Event Listener

I want to put an alert message on my Listener: if ($type == '-'){ if ($balance < $amo) { flash()->overlay('Warning!', 'Amount is higher than Balance.', 'warning'); } else { $wallet->users()->updateExistingPivot($uid,…
user9277271
0
votes
0 answers

Laravel event listener on autologin (remember me)?

In my Laravel 7.3 project I want to fire an event after a user login. This event should also be fired when a user has autologin ('Remember me'/Cookie Token) activated. Login via form is: (EventServiceProvider.php) 'Illuminate\Auth\Events\Login' =>…
Dominic
  • 440
  • 8
  • 22