Laravel-auditing: Laravel 5.5 compatibility

Created on 7 Sep 2017  路  11Comments  路  Source: owen-it/laravel-auditing

Is this package compatible with laravel 5.5?

question

Most helpful comment

@mbaeuerle, I'm unable to reproduce the issue you're having.

Here are the steps.

Create a new Laravel 5.5 project:

composer create-project --prefer-dist laravel/laravel laravel55

Install latest Laravel Auditing version:

cd laravel55
composer require owen-it/laravel-auditing

Output of the previous command:

Using version ^4.1 for owen-it/laravel-auditing
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing owen-it/laravel-auditing (v4.1.2): Loading from cache
owen-it/laravel-auditing suggests installing laravelista/lumen-vendor-publish (Needed to publish the package configuration in Lumen)
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Discovered Package: owen-it/laravel-auditing
Package manifest generated successfully.

Run the install command:

php artisan auditing:install

Output of the previous command:

Publishing the config files
Publishing the migration file
Successfully installed Laravel Auditing! Enjoy :)

All 11 comments

We successfully used it in Laravel 5.5 but you have to specifiy OwenIt\Auditing\AuditingServiceProvider::classas service provider in your config/app.php even though the docs state that it's not necessary with Laravel 5.5.

@mbaeuerle, according to this, you shouldn't have to.

I tried that, but unfortunately it didn't work without specifying the service provider.

The first problem that arises is the missing artisan commands for auditing (php artisan auditing:install)

And even when using the service provider just for installing auditing, there is an exception when using auditing afterwards without the provider:

    "message": "Target [OwenIt\\Auditing\\Contracts\\Auditor] is not instantiable.",
    "status_code": 500,
    "error_id": "a01eba45a0b249a7b013d2af27c5c6bb",
    "debug": {
        "line": 918,
        "file": "/var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php",
        "class": "Illuminate\\Contracts\\Container\\BindingResolutionException",
        "trace": [
            "#0 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(758): Illuminate\\Container\\Container->notInstantiable('OwenIt\\\\Auditing...')",
            "#1 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(631): Illuminate\\Container\\Container->build('OwenIt\\\\Auditing...')",
            "#2 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(586): Illuminate\\Container\\Container->resolve('OwenIt\\\\Auditing...', Array)",
            "#3 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(721): Illuminate\\Container\\Container->make('OwenIt\\\\Auditing...', Array)",
            "#4 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(1195): Illuminate\\Foundation\\Application->make('OwenIt\\\\Auditing...')",
            "#5 /var/www/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(159): Illuminate\\Container\\Container->offsetGet('OwenIt\\\\Auditing...')",
            "#6 /var/www/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(128): Illuminate\\Support\\Facades\\Facade::resolveFacadeInstance('OwenIt\\\\Auditing...')",
            "#7 /var/www/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(215): Illuminate\\Support\\Facades\\Facade::getFacadeRoot()",
            "#8 /var/www/vendor/owen-it/laravel-auditing/src/AuditableObserver.php(38): Illuminate\\Support\\Facades\\Facade::__callStatic('execute', Array)",

What version are you using, 4.1?

Yes I am using laravel-auditing version 4.1.2

Similar error, cant update my model App\Order

Type error: Argument 1 passed to OwenIt\Auditing\AuditableObserver::updated() must be an instance of OwenIt\Auditing\Contracts\Auditable, instance of App\Order given

Audit version 4.1.2.
Laravel version 5.5.3.

@rorc, that has nothing to do with Laravel 5.5. Read the documentation on how to use this library.

Sry, i forgot implementing AuditableContract 馃槅

@mbaeuerle, I'm unable to reproduce the issue you're having.

Here are the steps.

Create a new Laravel 5.5 project:

composer create-project --prefer-dist laravel/laravel laravel55

Install latest Laravel Auditing version:

cd laravel55
composer require owen-it/laravel-auditing

Output of the previous command:

Using version ^4.1 for owen-it/laravel-auditing
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing owen-it/laravel-auditing (v4.1.2): Loading from cache
owen-it/laravel-auditing suggests installing laravelista/lumen-vendor-publish (Needed to publish the package configuration in Lumen)
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Discovered Package: owen-it/laravel-auditing
Package manifest generated successfully.

Run the install command:

php artisan auditing:install

Output of the previous command:

Publishing the config files
Publishing the migration file
Successfully installed Laravel Auditing! Enjoy :)

For lumen, you have to add this line in bootstrap/app.php

$app->register(OwenIt\Auditing\AuditingServiceProvider::class);

In case anyone is doing some testing, this is needed:
imagen

Was this page helpful?
0 / 5 - 0 ratings