Open Laboratory for Technocrats

Grab the developer role, learn concepts & prepare with senior software engineers to get solutions for problems in a software job. Coding and Programming Solutions crafted for you.

Laravel - Undefined Variable Event Dispatcher::fire()

Laravel - Undefined Variable Event Dispatcher::fire()
Laravel - Undefined Variable Event Dispatcher::fire() 
The problem arouses when we were upgrading one of the in house project to the latest version of Php framework Laravel 5.8

The error was clean as it looked
Call to undefined method Illuminate\Events\Dispatcher::fire() in Laravel 5.8
But we went into the documentation over the official website and figured out that this was decided to take down on the previous version of Laravel version.

Why this happened?
fire() function is an alias of the dispatch() method
What needs to fix this? 
Use the dispatch() method instead of fire() method
Example
Initial Code

Illuminate\Events\Dispatcher::fire()
Updated Code

Illuminate\Events\Dispatcher::dispatch()
Once you change the fire() method to dispatch() method that specific Undefined variable error will be gone.

Let me us know in comments if there is any issue with respect to this article.

Keep Coding and Keep Smiling :)


Top #3 Articles