spatie / activitylog

A very simple activity logger to monitor the users of your website or application
https://spatie.be/opensource/laravel
MIT License
582 stars 75 forks source link

Argument 1 passed to Spatie\Activitylog\ActivityLogger::useLog() must be of the type string, null given #53

Closed MrBean14 closed 6 years ago

MrBean14 commented 6 years ago

Dear all,

I have imported ActivityLog V1 into my project. All was fine until I put the first line in the manual in my Controller.

activity()->log('Look mum, I logged something');

Unfortunately this shows the following error :

(1/1) FatalThrowableError
Type error: Argument 1 passed to Spatie\Activitylog\ActivityLogger::useLog() must be of the type string, null given, called in /var/www/public/plevoets/vendor/spatie/laravel-activitylog/src/helpers.php on line 11

Am I forgetting anything ?

Best regards,

Davy

MrBean14 commented 6 years ago

Sorry guys, might have been too quick. Had a look in the helpers file.


function activity(string $logName = null): ActivityLogger
    {
        $defaultLogName = config('laravel-activitylog.default_log_name');

        return app(ActivityLogger::class)->useLog($logName ?? $defaultLogName);
    }

So it was clear that the function "activity" needs some text. So I retried with

activity('Import')->log('Look mum, I logged something');

That worked...

Best regards,

Davy