Crazylife's avatar

Call to undefined function event()

I am trying to call event() in such way as shown below.

event(new User($user));

But it returns me Error: Call to undefined function Modules\User\Http\Controllers\API\event() in file /var/www/Modules/User/Http/Controllers/API/UserController.php on line 156

I found that the event function missing in Illuminate\Foundation\helpers.php

May I know what's wrong with this?

0 likes
2 replies
tykus's avatar

The event helper method has been there for literally years; did you modify files in the vendor directory? What is your Laravel version?

You should be able to safely delete the vendor directory and re-run composer update to get the correct dependencies

Crazylife's avatar

Yeah, i don't really modify files in the vendor directory. But after composer update it looks fine. But then event() function didn't trigger any job of mine.

Please or to participate in this conversation.