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
2 answers

Laravel Events and Listeners

This is my event class when i use class EventServiceProvider extends ServiceProvider { /** * The event listener mappings for the application. * * @var array */ protected $listen = [ …
Waheed Sindhani
  • 91
  • 1
  • 13
1
vote
0 answers

Undefined eager-loaded relationship when using Echo event broadcasting

I am using Laravel Echo in my project to broadcast events to the client-side. Everything is working correctly, however, I am having a problem in eager-loading the relationships of the model for the Event. My Controller $chat = new…
Jin
  • 153
  • 2
  • 12
1
vote
1 answer

Event and listener not function?

I want to create a first time user login to fill some details , after the user fill some details the second time he login won`t go back to the fill details page,. So I create a event to update Last_Login_at value Null become 1 so that the user will…
Tim Cheah
  • 11
  • 1
1
vote
1 answer

Laravel unit testing if an event is triggered when an eloquent model event is triggered

I am developing a Laravel application and writing tests as I go along the way. Now, I am having a problem writing a test that is asserting if an event is triggered when an eloquent model event is triggered. This is what I am doing. This is my…
Wai Yan Hein
  • 13,651
  • 35
  • 180
  • 372
1
vote
1 answer

Conditional subscription to listener in Laravel

I have set up a listener by adding it in EventServiceProvider protected $subscribe = [ MyListener::class ]; The listener (MyListener) has a subscribe function that subscribes to the events the listener wants to listen for - and it works…
Daniel
  • 10,641
  • 12
  • 47
  • 85
1
vote
1 answer

I want to generate an email report (email sent copy) as soon as the email sent to the user in Laravel using Mail function

I want to generate an email report (email sent copy) as soon as the email sent to the user in Laravel using the Mail function below is the sample image for sent email please find the attached sample image
1
vote
1 answer

What is the best option to send emails in laravel with different email template

We are currently using laravel Event listener to send emails for laravel. Basically this is a slot booking option, so sometimes we have to send emails to sender and sometimes we have to send to receiver and sometimes we have to send emails other…
anoop
  • 1,604
  • 6
  • 24
  • 50
1
vote
0 answers

Queue\SerializesModels removes variables Laravel Event

I'm using an event which broadcasts an user object. The user object contains "id":2, "name":"Clark", "surname":"Beer", "email":"schultz.arthur@example.com", "role":"user", "information":{ "user_id":2, "bio":"Dicta fugit…
1
vote
1 answer

Laravel event when the publishing date is came

I'm using Laravel but I searched for the appropriate way to do .. We write articles in our website and give them a publishing date. Those articles won't display in our website before the publishing date. Is there any way by using Laravel or another…
user9500574
  • 142
  • 1
  • 11
1
vote
0 answers

Laravel function "event" not working when broadcasting an event

I have the following code: /routes/web.php 'UserSignedUp', 'data' => [ 'username' => 'JohnDoe' ] ]; …
davidesp
  • 3,743
  • 10
  • 39
  • 77
1
vote
0 answers

Laravel event not found

I try to send notification via pusher when user submitted new order. in my CartController where I save data into my orders table I have:
mafortis
  • 6,750
  • 23
  • 130
  • 288
1
vote
2 answers

How to implement eloquent 'saving' event for all models , not individually

Based on documentation of laravel eloquent event, all the eloquent event are triggered individually based on each model, is there any way to use 'creating' event or any other eloquent event to be triggered by all the Models For example , if any…
Lejiend
  • 1,219
  • 2
  • 16
  • 24
1
vote
2 answers

Error when try to sending email in Laravel

I was try to make some email to send email acticvation code when someone register. so i make it an event called UserRegistered. here's my RegisterController that call the event public function store(Request $request){ $this->validate(…
Ying
  • 1,282
  • 4
  • 19
  • 34
1
vote
3 answers

Laravel Eloquent Events - implement to save model if Updated

I have such code in the controller: for($i=0; $i<$number_of_tourists; $i++) { $tourist = Tourist::updateOrCreate(['doc_number' => $request['doc_number'][$i]], $tourist_to_update); } so, the updateOrCreate method can 1) Update record, 2) Create a…
Sergej Fomin
  • 1,822
  • 3
  • 24
  • 42
1
vote
0 answers

InvalidArgumentException: Database [advertiser] not configured.

I have this weird error. In our app when an user creates or updates a group, we are adding that group to our Solr search index or update existing data through events. It used to work fine but now it has started to throw this…
Sayantan Das
  • 1,619
  • 4
  • 24
  • 43