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
2
votes
1 answer

How to listen to events in tests in Laravel 5?

I am trying to test emails in laravel 5 and I have realised that Swift_Mailer triggers Illuminate\Mail\Events\MessageSending event whenever a mail is being sent. But since I am beginner, I am having trouble comprehending how to listen to this event…
Rohan
  • 13,308
  • 21
  • 81
  • 154
2
votes
2 answers

How to listen for an event in Laravel 5.2?

I have a Laravel package that fires an event which is located in the vendor folder. The event's class that is being fired is Mikea\Kicker\Events\Interviews\SurveyWasCompleted I need to listen in for that event and then die and dump the event's…
Junior
  • 11,602
  • 27
  • 106
  • 212
1
vote
1 answer

Dispatching event from Model with custom event key

I'm currently rebuilding an application and I currently have this in observer public function updated(Lead $lead) { if ( $lead->isDirty('status') && $lead->status === 'rejected') { LeadRejected::dispatch($lead); } …
SymmetricsWeb
  • 586
  • 6
  • 20
1
vote
0 answers

Broadcast event to Pusher when database notification is created

This is related to an earlier question I asked: Am I overcomplicating events/listeners/notifications?. Based on the feedback received on that question, I modified my approach to attempt to do the following: Fire a database notification. Listen for…
hyphen
  • 2,368
  • 5
  • 28
  • 59
1
vote
0 answers

Create multi-channels in Pusher Laravel with different events

I have a multi-vendor E-commerce with users making orders, and drivers making offers on these orders, I made a pusher channel so that when a user makes an order it shows on the drivers home realtime. class NewOrderEvent implements…
1
vote
0 answers

Remove all items from cache whose key start with string

I want to remove all the cache items whose key is starting with custom string. Currently, I have a PermissionObserver for the Permission model with a custom trait ObserverEvent to called this handle method. class PermissionObserver { use…
JS TECH
  • 1,556
  • 2
  • 11
  • 27
1
vote
1 answer

Find which model method is triggering the Event

I'm using Laravel's Event & Listener functionality to detect the following model actions and trigger some application logic. app/models/MealFood /** * The event map for the model. * * Allows for object-based events for native Eloquent events. * …
shAkur
  • 944
  • 2
  • 21
  • 45
1
vote
2 answers

Cannot subscribe to a private or presence channel because no Authorizer has been set. Call PusherOptions.setAuthorizer() before connecting to Pusher

In a chat application, Laravel 7.x, Vuejs 2, Flutter 2.8 and Pusher Pacakges I use pusherjs, Laravel echo, pusher-php-server and Flutter pusher_client. in Laravel & Vue public and private channels work fine, in with Flutter public channel also…
Zia
  • 506
  • 3
  • 20
1
vote
1 answer

Fire an event from Laravel controller and listen on Livewire component

I'm trying to figure if i could emit an event from a Laravel regular controller and define a listener on a Livewire component. There's my journey so far: I've generated the event: php artisan make:event NewOrder then, on the Controller method…
JS_LnMstr
  • 348
  • 1
  • 6
  • 18
1
vote
2 answers

Laravel pusher event not getting triggered

Here is my .env code-> BROADCAST_DRIVER=pusher PUSHER_APP_ID=xxxxx PUSHER_APP_KEY=xxxxx PUSHER_APP_SECRET=xxxxx PUSHER_APP_CLUSTER=xxxxx Here is my config code -> 'pusher' => [ 'driver' => 'pusher', 'key' =>…
1
vote
2 answers

Laravel 5.8: How to pass two arguements to Event & Listener

I'm using Laravel 5.8 and I have created an Event called UserWalletNewTransaction that goes like this: public $transaction; public $added_type; public function __construct($transaction, $added_type) { $this->transaction = $transaction; …
user9277271
1
vote
0 answers

Laravel: BroadcastWhen equivalent for events

I am searching for an equivalent to Laravel's broadcastWhen() function to use it for my events. Goal is to reduce events placed on the queue by certain conditions. I tried using a Event which implements the ShouldBroadcast Interface, but surely the…
IboJaan
  • 63
  • 7
1
vote
0 answers

Private channel authorization - one to one chat

I have chat rooms that for now are one-to-one chats between two users. This is the channel without authorization Broadcast::channel('chat.{roomId}', function ($user, $roomId) { return ['id' => $user->id, 'name' => $user->name]; }); This way it…
1
vote
1 answer

Laravel event() not working in production

im trying to deploy my laravel-project via forge and digitalocean. And while it is working perfectly fine in my local development enviroment, im having a hard time getting the laravel-websockets package running. So while my "CruiseCrontroller" is…
N. Kue
  • 77
  • 1
  • 7
1
vote
1 answer

Multiple Traits on one model from chelout/laravel-relationship-events

I am building a model and using chelout/laravel-relationship-events to capture events. I have a model that looks like this: class Taxonomyterm extends Model { use HasMorphToManyEvents, HasMorphedByManyEvents { …
Toby Joiner
  • 4,306
  • 7
  • 32
  • 47