'Laravel event dispatch in web.php

I just wanted to use event broadcasting in Laravel and I followed a tutorial video. But problem shows up in the beginning. The tutorial shows what to do in web.php and it goes like this:

Route::get( uri: '/'. action: function () {
   eventName::dispatch();
   return view( view: 'welcome');
});

The problem is I have a different route formula in my web.php which is like this:

Route::get('{path}', SpaController::class)->where('path', '(.*)');

The question is, how to dispatch the event in my web.php?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source