117 questions
0
votes
1
answer
67
views
Laravel Echo Server not receiving broadcast events even though WebSocket connection is successful
I’m using Laravel 8 with Redis and laravel-echo-server to broadcast events to my frontend.
The WebSocket connection is successful (status 200), but the broadcasted event from Laravel never shows up in ...
1
vote
0
answers
69
views
Laravel 11 WS only event handling and listeners
I am trying to build a multiplayer game using only WebSockets for the chat and the game moves.
My version is laravel 11, I started this before v12 came out. I am also using Laravel Reverb for the ...
2
votes
2
answers
189
views
How to handle eloquent.deleted Event for all Models right?
I want to run an action after any model got deleted, but currently it seems like I do something wrong.. I already get the Model before I delete it, so the event should get fired.
As I do already some ...
0
votes
0
answers
611
views
Laravel Reverb not connecting, everytime I make changes
I just tried laravel reverb, and I noticed that everytime I make some changes in the code, I can't connect to the websocket.
Console Error/Warning
I returned the code back to where I started, but I ...
0
votes
0
answers
250
views
How to Inject Services into a Queued Event Listener using Laravel 7?
I'm using Laravel 7. would like like to inject services into a event listener. Injecting their interfaces through the constructor works fine, but when I add "implements ShouldQueue" to the ...
0
votes
1
answer
257
views
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 ...
0
votes
1
answer
192
views
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 ...
1
vote
1
answer
541
views
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')...
1
vote
1
answer
963
views
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 ...
1
vote
0
answers
694
views
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.
...
0
votes
1
answer
678
views
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));
$...
3
votes
0
answers
2k
views
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 ...
0
votes
1
answer
963
views
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/...
0
votes
1
answer
341
views
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 ...
2
votes
1
answer
1k
views
How to pass the object from a listener of an event to another listener of the same event
In Laravel 9, I have created an Event called RegisterNewUserEvent with this __construct function ($data here holds the $request data of a form).
public function __construct($data)
{
$this->data ...
1
vote
1
answer
1k
views
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 ...
1
vote
2
answers
3k
views
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 ...
1
vote
1
answer
6k
views
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:...
-1
votes
1
answer
89
views
How to reduce the code from policy file in laravel?
I have two files userPolicy.php and userObserver.php , i write some logic inside both files what it does means if a user have any active subscriptions that user won't be deleted upto this it's ...
1
vote
1
answer
10k
views
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 ...
1
vote
3
answers
2k
views
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' => [
...
0
votes
1
answer
178
views
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 {
...
3
votes
2
answers
3k
views
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)
{...
2
votes
2
answers
1k
views
Laravel 5.8: Parameter passed to the event listener is getting null
I have created an Event called UserWalletNewTransaction.php and added this to it:
public $transaction;
public function __construct($transaction) {
$this->$transaction = $transaction;
}
And ...
-1
votes
2
answers
1k
views
Undefined property: App\Events\UserWalletNewTransaction::$user_id
I have created an Event called UserWalletNewTransaction.php and added this to it:
public $transaction;
public function __construct($transaction) {
$this->$transaction = $transaction;
}
And ...
0
votes
0
answers
495
views
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: (...
0
votes
0
answers
204
views
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 ...
2
votes
2
answers
481
views
Argument 3 passed to App\Events\NoticeAnnouncement::__construct() must be an instance of App\User
I am trying to send mail to all students when a notice will be posted by a teacher. For this, I am calling a event when the notice is being created, and passed notice,teacher and user through the ...
1
vote
0
answers
118
views
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 ...
0
votes
0
answers
798
views
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 ...
0
votes
0
answers
660
views
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 ...
1
vote
0
answers
316
views
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' => ...
1
vote
1
answer
3k
views
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....
1
vote
1
answer
685
views
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 ...
2
votes
0
answers
531
views
Creating a structure with Jobs, Events, Listeners, Queues in Laravel 8
I have a flow about that. I can solve the problem on paper. As a system admin, we have the following models: Clients, Departments, Users, Visitors, Calls, and Meetings.
Clients are our customers.
...
0
votes
1
answer
1k
views
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 ...
0
votes
1
answer
259
views
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', '...
0
votes
1
answer
248
views
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::...
0
votes
0
answers
1k
views
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'...
1
vote
1
answer
678
views
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, ...
1
vote
2
answers
3k
views
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
...
0
votes
1
answer
215
views
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 . com/api-...
1
vote
0
answers
130
views
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 ...
0
votes
0
answers
268
views
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 ...
0
votes
1
answer
1k
views
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 ...
3
votes
2
answers
755
views
Logout Event (Laravel 7)
I'm pretty new to Laravel and was wondering how I can set up a function to run on an event. Specifically, when a user log outs, how can I call a function?
What would be the best way to do this, ...
0
votes
0
answers
4k
views
Laravel Eloquent delete event is not firing
My EventServiceProvider.php:
protected $listen = [
'eloquent.deleted: *' => [
'App\Listeners\EloquentListener',
],
'eloquent.deleting: *' => [
'App\Listeners\...
5
votes
2
answers
5k
views
lararvel uuid as primary key
I'm trying to set an uuid as primary key in a Laravel Model. I've done it setting a boot method in my model as stablished here so I don't have to manually create it everytime I want to create and save ...
45
votes
10
answers
125k
views
LogicException: Please make sure the PHP Redis extension is installed and enabled
Laravel Version: 7.5.0
PHP Version: 7.2
Database Driver & Version: Redis
Everything was working fine but suddenly this error appear i changed the phpredis to predis but error is same.
Steps To ...
4
votes
1
answer
10k
views
How to manually trigger Laravel model event
When no data is changed then laravel checks for isDirty and never executed the update query and hence model updated event is not fired. How can we manually trigger an event?