diff --git a/app/Models/User.php b/app/Models/User.php index ce190dbfc8..861a62d9eb 100755 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -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'); } /** diff --git a/resources/views/users/print.blade.php b/resources/views/users/print.blade.php index 8ecf450f3c..b218bc74db 100644 --- a/resources/views/users/print.blade.php +++ b/resources/views/users/print.blade.php @@ -152,7 +152,7 @@ {{ str_repeat('x', 15) }} @endcan - {{ $license->assetlog->first()->created_at }} + {{ $license->pivot->created_at }} @php $lcounter++ @@ -188,7 +188,7 @@ {{ $acounter }} {{ ($accessory->manufacturer) ? $accessory->manufacturer->name : '' }} {{ $accessory->name }} {{ $accessory->model_number }} {{ $accessory->category->name }} - {{ $accessory->assetlog->first()->created_at }} + {{ $accessory->pivot->created_at }} @php $acounter++ @@ -232,7 +232,7 @@ @endif {{ ($consumable->category) ? $consumable->category->name : ' invalid/deleted category' }} - {{ $consumable->assetlog->first()->created_at }} + {{ $consumable->pivot->created_at }} @php $ccounter++