Make the report take the dates of pivot table instead of asset log

This commit is contained in:
Ivan Nieto Vivanco 2022-04-05 12:57:49 -05:00
parent d56552a8af
commit 2d213a9c77
2 changed files with 5 additions and 5 deletions

View file

@ -305,7 +305,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
*/
public function consumables()
{
return $this->belongsToMany('\App\Models\Consumable', 'consumables_users', 'assigned_to', 'consumable_id')->withPivot('id')->withTrashed();
return $this->belongsToMany('\App\Models\Consumable', 'consumables_users', 'assigned_to', 'consumable_id')->withPivot('id', 'created_at')->withTrashed();
}
/**
@ -317,7 +317,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
*/
public function licenses()
{
return $this->belongsToMany('\App\Models\License', 'license_seats', 'assigned_to', 'license_id')->withPivot('id');
return $this->belongsToMany('\App\Models\License', 'license_seats', 'assigned_to', 'license_id')->withPivot('id', 'created_at');
}
/**

View file

@ -152,7 +152,7 @@
<i class="fa-lock" aria-hidden="true"></i> {{ str_repeat('x', 15) }}
@endcan
</td>
<td>{{ $license->assetlog->first()->created_at }}</td>
<td>{{ $license->pivot->created_at }}</td>
</tr>
@php
$lcounter++
@ -188,7 +188,7 @@
<td>{{ $acounter }}</td>
<td>{{ ($accessory->manufacturer) ? $accessory->manufacturer->name : '' }} {{ $accessory->name }} {{ $accessory->model_number }}</td>
<td>{{ $accessory->category->name }}</td>
<td>{{ $accessory->assetlog->first()->created_at }}</td>
<td>{{ $accessory->pivot->created_at }}</td>
</tr>
@php
$acounter++
@ -232,7 +232,7 @@
@endif
</td>
<td>{{ ($consumable->category) ? $consumable->category->name : ' invalid/deleted category' }} </td>
<td>{{ $consumable->assetlog->first()->created_at }}</td>
<td>{{ $consumable->pivot->created_at }}</td>
</tr>
@php
$ccounter++