Laravel-auditing: Argument 1 passed to OwenIt\Auditing\AuditableObserver::created() must be an instance of

Created on 22 Mar 2017  路  3Comments  路  Source: owen-it/laravel-auditing

Hi good day.
I have the following error.

Argument 1 passed to OwenIt\Auditing\AuditableObserver::created() must be an instance of OwenIt\Auditing\Contracts\Auditable, instance of App\Models\Areas given

My Model

<?php
namespace App\Models;

use OwenIt\Auditing\Auditable;
use Illuminate\Database\Eloquent\Model;


class Areas extends Model
{
    use Auditable;
    .....

I hope you can help me .
thank you very much

Most helpful comment

Thank you very much.

My solution:

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use OwenIt\Auditing\Auditable;
**use OwenIt\Auditing\Contracts\Auditable as AuditableContract;**


class Areas extends Model **implements AuditableContract
{**
    use Auditable;

All 3 comments

Please refer to the documentation and make sure you follow the examples before creating a new issue.
This particular one has been covered a few times already (#181, #203, #207).

There's a basic example in the introduction.

Thank you very much.

My solution:

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use OwenIt\Auditing\Auditable;
**use OwenIt\Auditing\Contracts\Auditable as AuditableContract;**


class Areas extends Model **implements AuditableContract
{**
    use Auditable;

Carefully Read the documentations, you missed something definitely.

http://laravel-auditing.com/docs/9.0/model-setup

Was this page helpful?
0 / 5 - 0 ratings