Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5 - Error Call to undefined method Illuminate\Events\Dispatcher::fire()

I'm working on a REST API using JWT.

The login route is good, but the router in group middleware jwt.auth doesn't work.

Error:

Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined method Illuminate\Events\Dispatcher::fire()

My code:

Route::group(['namespace' => 'Api'], function(){

    Route::get('user/login', 'AuthController@login');

    Route::group(['middleware' => ['jwt.auth']], function() {            
        Route::get('auth/me', 'AuthController@me');
    });
});
like image 917
StalynPunkSR Avatar asked Mar 04 '19 08:03

StalynPunkSR


2 Answers

fire was changed to dispatch in laravel 5.8 here https://github.com/laravel/framework/pull/26392

like image 91
kheengz Avatar answered Sep 26 '22 02:09

kheengz


If you use tymondesigns/jwt-auth package, this issue help you : https://github.com/tymondesigns/jwt-auth/issues/1787

This version fix this problem : https://github.com/tymondesigns/jwt-auth/releases/tag/1.0.0-rc.4

like image 22
Camille Bouvat Avatar answered Sep 25 '22 02:09

Camille Bouvat