Laravel-auditing: Everything breaks after install

Created on 2 May 2017  路  3Comments  路  Source: owen-it/laravel-auditing

After installing this package my Laravel installation breaks. After redownloading a fresh copy to try this again, it also breaks. The error I get is as follows:

[Symfony\Component\Debug\Exception\FatalThrowableError] Call to undefined method Closure::__set_state()

These are the steps I followed:

Step 1: composer require owen-it/laravel-auditing

Step 2: Add OwenIt\Auditing\AuditingServiceProvider::class, to my config/app.php inside the providers section.

Step 3: Clear the cache because Laravel doesn't know about this new package php artisan config:cache. Not doing this step obviously results in errors.

Step 4: Final step: php artisan auditing:install

Step 5: Report to this repo as it spews out the above issue.

broken

Any ideas?

duplicate help wanted

All 3 comments

Hi @jaminscript,

I did the following steps, but could not reproduce such error:

Create a new project:

create-project --prefer-dist laravel/laravel blog

Install the package:

cd blog
composer require owen-it/laravel-auditing

Add OwenIt\Auditing\AuditingServiceProvider::class to the providers array in config/app.php.

Publish the default configuration file:

php artisan auditing:install

Get this output:
auditing-install

Also having the same issue in laravel 5.4. Because of this part in the config/audit.php:

'user' => [
'model' => App\User::class,
'resolver' => function () {
return Auth::check() ? Auth::user()->getAuthIdentifier() : null;
},
],

php artisan config:cache is causing the creation of the following in cache/config.php:

``php... array ( 'user' => array ( 'model' => 'App\\User', 'resolver' => Closure::__set_state(array( )), ), 'default' => 'database', 'drivers' => array ( 'database' => array ( 'table' => 'audits', 'connection' => NULL, ), ), 'console' => true, ), ... which is causing the error: Error: Call to undefined method Closure::__set_state()`

Use a FQCN instead of a closure. See here.

Was this page helpful?
0 / 5 - 0 ratings