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
0
votes
0 answers

Send webhook at specific datetime laravel 8

In my application (laravel 8) i create some messages, store them in a postgrey database and send them via webhook to discord ans slack. I can choose to send them right away or delay them with a datetime in the database. Here is my problem. I dont…
0
votes
0 answers

Execute more than one event one after another before rendering something in Laravel | Events | Listeners

I have a Laravel application where I use Laravel event and Listeners. In my real use case, whenever a user visits the Invoice details page I want to execute two events. One of them actually inserts some related data for the invoice. but on the…
Sachin Kumar
  • 3,001
  • 1
  • 22
  • 47
0
votes
0 answers

send 2 different emails when laravel event triggered

I want to have 2 notifications when new user registered: inform admin that we have new user for moderation send welcome email to new user I created 2 events, put them in EventServiceProvider, but as result I have 2 emails to admin. I already tried…
schel4ok
  • 634
  • 1
  • 11
  • 33
0
votes
1 answer

Laravel /broadcasting/auth Always forbidden with 403 Error

I tried many solutions but no one works for me I've installed Laravel echo and pusher js and Pusher/Pusher #bootstrap.js import Echo from 'laravel-echo'; window.Pusher = require('pusher-js'); window.Echo = new Echo({ broadcaster: 'pusher', …
Hadayat Niazi
  • 1,991
  • 3
  • 16
  • 28
0
votes
1 answer

Laravel websockets caching event class and doesn't reload changes

I cannot change the channel name in the event class. Every change I make in the class is not loaded. (I am using laravel-websockets) /app/Events/BroadcastingModelEvent class BroadcastingModelEvent implements ShouldBroadcast { use…
grimdbx
  • 175
  • 2
  • 12
0
votes
1 answer

Laravel send same notification via different methods

I'm trying to ->notify() different users of the same type via different notification methods. For example: I have TicketCompleted notification and its via() method contains: return ['mail', 'database'];. I also have both methods toArray() and…
Petyor
  • 389
  • 3
  • 12
0
votes
1 answer

Laravel Updated Event Not Working Properly

Laravel Version: 7.14.1 Here is my Email Model. class Email extends Model { public static function boot() { parent::boot(); static::updated(function($obj) { \Log::info('1-'.$obj->status); …
LoveCoding
  • 1,121
  • 2
  • 12
  • 33
0
votes
0 answers

Calling event in Laravel controller

How do you define event controller like in the route? I'm following this tutorial and the code in route is something like this where you can directly access an event. Route web.php Route::get('/sender', function(){ return…
Emerald
  • 389
  • 1
  • 7
  • 18
0
votes
1 answer

GuzzleHttp not working inside Laravel Listener

I'm trying to shorten certain URL's using tiny URL API because I'm trying to limit the number of characters sent in an SMS. Usually, I do this: $sms_url = file_get_contents('http://tinyurl .…
elimariaaa
  • 796
  • 4
  • 10
  • 30
0
votes
0 answers

Laravel event cannot get data from model relationship using load() method

I cannot get the data from the model with a relationship. But when I use return response()->json($chat->load('attachments')) I can get the attachments. I want to get data Chat data with the attachments. This is my Model Chat.php class Chat extends…
Jin
  • 153
  • 2
  • 12
0
votes
1 answer

Get newly created id inside laravel 'created' event

I am using laravel created event. I want to use newly created id in another table. But when i print created object, i don't get the id property. How can i get newly created id in created event. This is my code. public static function booted() { …
0
votes
0 answers

Laravel Eloquent delete event is not firing

My EventServiceProvider.php: protected $listen = [ 'eloquent.deleted: *' => [ 'App\Listeners\EloquentListener', ], 'eloquent.deleting: *' => [ 'App\Listeners\EloquentListener', ] ]; But its not working. when I do it…
omero
  • 93
  • 1
  • 4
  • 10
0
votes
1 answer

laravel userstamps without disturbing the database seeding

Is there any way to automate the filling of a created_by column without the use of observers, but keeping my controllers clean? I don't want to use observers because when I try to seed my database, errors happen. The way I'm doing now: class…
Vitor Mattos
  • 56
  • 2
  • 8
0
votes
1 answer

Not following how to test broadcast events in laravel

So consider the following event: class UpdateApprovedClinicianCountBroadcastEvent implements ShouldBroadcast { use Dispatchable, InteractsWithSockets; public $count; /** * Create a new event instance. * * @return void …
TheWebs
  • 12,470
  • 30
  • 107
  • 211
0
votes
2 answers

Laravel created event returning the wrong record

I'm currently using Laravel observers to implement events in my project, however, I ran into some problem where the created event returns a wrong record, for example, I create a record called Like that has post_id set to 2 and user_id set to 1, so…
flex_
  • 679
  • 2
  • 8
  • 26