laravel-auditing
Greetings community I am trying to implement the owen-it / laravel-auditing package in my project.I am following this example as a basis this is the link: https://pusher.com/tutorials/realtime-audit-trail-laravel. In this case I apply the audit to my posts model, for this example I have only changed the title of my post. Wanting to see the audit results in my view audit.blade.php I get the following error:
htmlspecialchars () expects parameter 1 to be string, array given (View: C: \ xampp \ htdocs \ tecind \ resources \ views \ audits \ audit.blade.php)
My view is as follows:
@extends('layouts.app')
@section('header')
<h1>
AUDITORIA
<small>Listado </small>
</h1>
<ol class="breadcrumb">
<li><a href="{{ route('dashboard') }}"><i class="fa fa-dashboard"></i> Inicio</a></li>
<li class="active">Auditoria</li>
</ol>
@stop
@section('content')
<div class="container">
<table class="table" >
<thead class="thead-dark">
<tr>
<th scope="col">Model</th>
<th scope="col">Action</th>
<th scope="col">User</th>
<th scope="col">Time</th>
<th scope="col">Old Values</th>
<th scope="col">New Values</th>
</tr>
</thead>
<tbody id="audits">
@foreach($audits as $audit)
<tr>
<td>{{ $audit->auditable_type }} (id: {{ $audit->auditable_id }})</td>
<td>{{ $audit->event }}</td>
<td>{{ $audit->user->name }}</td>
<td>{{ $audit->created_at }}</td>
<td>
<table class="table">
@foreach($audit->old_values as $attribute => $value)
<tr>
<td><b>{{ $attribute }}</b></td>
<td>{{ $value }}</td>
</tr>
@endforeach
</table>
</td>
<td>
<table class="table">
@foreach($audit->new_values as $attribute => $value)
<tr>
<td><b>{{ $attribute }}</b></td>
<td>{{ $value }}</td>
</tr>
@endforeach
</table>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection
I think the problem is right when you enter here:
<td>
<table class="table">
@foreach($audit->old_values as $attribute => $value)
<tr>
<td><b>{{ $attribute }}</b></td>
<td>{{ $value }}</td>
</tr>
@endforeach
</table>
</td>
<td>
<table class="table">
@foreach($audit->new_values as $attribute => $value)
<tr>
<td><b>{{ $attribute }}</b></td>
<td>{{ $value }}</td>
</tr>
@endforeach
</table>
</td>
If I delete it and redirect myself in sight I can see data from previous I talk about this:
<td>{{ $audit->auditable_type }} (id: {{ $audit->auditable_id }})</td>
<td>{{ $audit->event }}</td>
<td>{{ $audit->user->name }}</td>
<td>{{ $audit->created_at }}</td>
Following the tutorial I think that in this part he makes a comparison between old and updated data, showing the changes of each field. Please see the preview of the tutorial so you understand me better Could someone at least give me a clue on how to solve the problem?
Please or to participate in this conversation.