Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception occurred when triggering event that is not auditable #212

Closed
yeelok opened this issue Mar 17, 2017 · 5 comments
Closed

Exception occurred when triggering event that is not auditable #212

yeelok opened this issue Mar 17, 2017 · 5 comments
Labels
bug Issue, error or unexpected behavior

Comments

@yeelok
Copy link

yeelok commented Mar 17, 2017

I have set $auditableEvents to only audit on update
protected $auditableEvents = [ 'updated' ];

after that, when I create the eloquent modal it throws this below exception
A valid audit event must be set

@quetzyg
Copy link
Contributor

quetzyg commented Mar 17, 2017

Has the $this->auditEvent value been set? Have you followed the examples in the documentation? What are you doing exactly? The information provided is not enough to help you.

@yeelok
Copy link
Author

yeelok commented Mar 17, 2017

Yes, i just want to only create audit when updating the model.
I haven't touch on the package source, so the $this->auditEvent is set as null
I have only add the $auditableEvents array in my model

@quetzyg
Copy link
Contributor

quetzyg commented Mar 17, 2017

Yes, you already said that. Can you show the actual code you're using?

@yeelok
Copy link
Author

yeelok commented Mar 17, 2017

This is my model class

namespace App;

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

class Test extends Model implements AuditableContract
{
    use Auditable;

    protected $auditableEvents = [
        'updated',
    ];
}

This is the script to trigger the exception

$test = new \App\Test();
$test->save();

@quetzyg quetzyg added the bug Issue, error or unexpected behavior label Mar 18, 2017
@quetzyg
Copy link
Contributor

quetzyg commented Mar 18, 2017

Working on a fix.

@quetzyg quetzyg mentioned this issue Mar 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue, error or unexpected behavior
Projects
None yet
Development

No branches or pull requests

2 participants