Laravel v5.7.24
Laravel 审计 v8.0.4
PHP 版本 7.3.1
我有一个与Laravel Auditing包相关的特定问题。虽然我设置了模型和文档中的所有内容,但刀片模板向我显示了一个错误Call to undefined method stdClass::getModified()
。太感谢了。
这是我的模型:
namespace App;
use Laravel\Scout\Searchable;
use Illuminate\Database\Eloquent\Model;
use OwenIt\Auditing\Contracts\Auditable;
class Post extends Model implements Auditable
{
use Searchable, \OwenIt\Auditing\Auditable;
protected $fillable = [...];
protected $auditExclude = [...];
public function user()
{
return $this->belongsTo('App\User');
}
}
刀片视图:
<ul>
@forelse ($audits as $audit)
<li>
@foreach ($audit->getModified() as $attribute => $modified)
<ul>
<li>@lang('article.'.$audit->event.'.modified.'.$attribute, $modified)</li>
</ul>
@endforeach
</li>
@empty
<p>@lang('article.unavailable_audits')</p>
@endforelse
</ul>