-
Notifications
You must be signed in to change notification settings - Fork 391
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
Configurable Audit Model #211
Comments
Hi @Kaylakaze, I'm assuming you changed the model being extended in the |
I changed the from Illuminate\Eloquent\Model to Jenssegers\Mongodb\Eloquent\Model. My thought was it'd be easy enough for the end user to make their own copy of Audit in their app folder and change it how they need to and reference that in the config. |
This issue should now be fixed in I'll have to update the documentation, but what needs to be done is: <?php
namespace App\Models;
use Jenssegers\Mongodb\Eloquent\Model;
use OwenIt\Auditing\Audit as AuditTrait;
use OwenIt\Auditing\Contracts\Audit as AuditContract;
class Audit extends Model implements AuditContract
{
use AuditTrait;
/**
* {@inheritdoc}
*/
protected $guarded = [];
/**
* {@inheritdoc}
*/
protected $casts = [
'old_values' => 'json',
'new_values' => 'json',
];
} This is for you too, @bsormagec! |
Actually, I might be missing a few more things, hold on. |
OK, so... Besides implementing an return [
// ...
'implementation' => App\Models\Audit::class,
// ...
]; Don't forget to try the latest code in EDIT: The documentation has been updated. |
Marking issue as solved. |
There should be a way to declare a custom Audit model. Since it extends from the default Eloquent model, it is currently incompatible with MongoDB. Simply changing which Model it "use"s worked with no problems, but editing vendor files is generally not a good idea.
The text was updated successfully, but these errors were encountered: