Closed NDanilov2015 closed 3 years ago
Hi,
The user events provided by the frontend are triggered on GET routes, not POST/PATCH routes. They're designed for cases where you might want to display what a user is doing (e.g. "Writing a post") or for analytical purposes. If you want to actually react to a post being created, you should instead use Eloquent model events (specifically, the created
event on the Post model). I won't go into details about how to do that since it's a Laravel feature, not part of the package - all you need to refer to from the package is the Post model.
Note that this is different in version 5, where events are provided by the package for every CRUD/BREAD action.
Hope that helps :)
But send message - always not GET, but POST method.
But send message - always not GET, but POST method.
Yes, that's why you need to use Eloquent events instead.
The package events only cover GET routes. Eloquent events cover model inserts/updates/deletes resulting from POST/PATCH routes.
Eloquent Events like "PostCreated" not fire.
I can't offer Laravel support, sorry. Eloquent events should cover your needs but they are outside the scope of this package.
okay
Good day!
In my code app\providers\EventServiceProvider.php I wrote:
protected $listen = [ 'Riari\Forum\Frontend\Events\UserCreatingPost' => [ 'App\Listeners\UserCreatingPostListener', ], ];
where "App\Listeners\UserCreatingPostListener" - my listeners.
But my listeners not calling in reality whem User written new post. What reasons can be?
Thank you.