jeremykenedy / laravel-logger

An out the box activity logger for your Laravel or Lumen application. Laravel logger is an activity event logger for your laravel application. It comes out the box with ready to use with dashboard to view your activity. Laravel logger can be added as a middleware or called through a trait. This package is easily configurable and customizable. Supports Laravel 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 6, and 7+
MIT License
579 stars 120 forks source link

Non-static method ActivityLogger::activity() cannot be called statically after PR #166 #169

Closed denydias closed 9 months ago

denydias commented 9 months ago

PR #166 introduced an exception in listeners:

[2024-01-06 03:11:08] app.ERROR: Non-static method jeremykenedy\LaravelLogger\App\Http\Traits\ActivityLogger::activity() cannot be called statically {"userId":1,"exception":"[object] (Error(code: 0): Non-static method jeremykenedy\\LaravelLogger\\App\\Http\\Traits\\ActivityLogger::activity() cannot be called statically at app/vendor/jeremykenedy/laravel-logger/src/App/Listeners/LogSuccessfulLogin.php:32)

This is due the fact the listeners still calls ActivityLogger::activity() statically. These should be converted to ActivityLogger->activity() calls.

Affected listeners are:

# Listeners/LogAuthenticationAttempt.php:
ActivityLogger::activity(trans('LaravelLogger::laravel-logger.listenerTypes.attempt'));

#Listeners/LogPasswordReset.php
ActivityLogger::activity(trans('LaravelLogger::laravel-logger.listenerTypes.reset'));

#Listeners/LogLockout.php
ActivityLogger::activity(trans('LaravelLogger::laravel-logger.listenerTypes.lockout'));

#Listeners/LogAuthenticated.php
ActivityLogger::activity(trans('LaravelLogger::laravel-logger.listenerTypes.auth'));

Listeners/LogSuccessfulLogout.php#
ActivityLogger::activity(trans('LaravelLogger::laravel-logger.listenerTypes.logout'));

#Listeners/LogFailedLogin.php
ActivityLogger::activity(trans('LaravelLogger::laravel-logger.listenerTypes.failed'));

#Listeners/LogSuccessfulLogin.php
ActivityLogger::activity(trans('LaravelLogger::laravel-logger.listenerTypes.login'));
jeremykenedy commented 9 months ago

Related to issue 150

denydias commented 9 months ago

My bad! Closing this in favor of #150.