mardi 6 février 2018

OwenIt \ Auditing \ Exceptions \ AuditingException Invalid UserResolver implementation using owen-it/laravel-auditing

I am using owen-it/laravel-auditing for keeping history of changes of prices of products. But I am getting error while updating prices.

OwenIt \ Auditing \ Exceptions \ AuditingException Invalid UserResolver implementation

Prices do get updated but is history is not updated in database

Products.php

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Auth;
use OwenIt\Auditing\Contracts\Auditable;
use OwenIt\Auditing\Contracts\UserResolver;

class Products extends Model implements Auditable, UserResolver
{
    use \OwenIt\Auditing\Auditable;

    protected $table = 'products';
    protected $fillable = ['name','price','season','category','description','stock','image'];

    protected $auditInclude = [
        'name',
        'price',
    ];

    public static function resolveId()
    {
        return Auth::check() ? Auth::user()->getAuthIdentifier() : null;
    }


}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire