salmazz / possystem

0 stars 0 forks source link

Call to undefined method Illuminate\Events\Dispatcher::fire() #1

Open deva7mad opened 4 years ago

deva7mad commented 4 years ago
Symfony\Component\Debug\Exception\FatalThrowableError  : Call to undefined method Illuminate\Events\Dispatcher::fire()

  at /var/www/html/possystem/vendor/santigarcor/laratrust/src/Traits/LaratrustHasEvents.php:46
    42|         if (! isset(static::$dispatcher)) {
    43|             return true;
    44|         }
    45| 
  > 46|         return static::$dispatcher->fire(
    47|             "laratrust.{$event}: ".static::class,
    48|             $payload
    49|         );
    50|     }

  Exception trace:

  1   App\User::fireLaratrustEvent("role.attached")
      /var/www/html/possystem/vendor/santigarcor/laratrust/src/Traits/LaratrustUserTrait.php:398

  2   App\User::attachModel("roles")
      /var/www/html/possystem/vendor/santigarcor/laratrust/src/Traits/LaratrustUserTrait.php:487

  Please use the argument -v to see more details.

Problem comes from Laravel trust package.

deva7mad commented 4 years ago

The Event method fire is deprecated in Laravel v5.8 However it works on prior version of Laravel v5.7 You can use the method dispatch in Laravel v5.8 and later. It works same as fire method and dispatches the event to event handler function registered in EventServiceProvider

You need to replace Laravel trust package version with one that's compatible with laravel 5.8.