Changed the method name, since it will return an entire collection

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2023-01-10 12:18:27 -08:00
parent 46e17f7e77
commit adec86f1ef
2 changed files with 3 additions and 3 deletions

View file

@ -190,8 +190,8 @@ class AssetsTransformer
'email'=> ($asset->assigned->email) ? e($asset->assigned->email) : null, 'email'=> ($asset->assigned->email) ? e($asset->assigned->email) : null,
'employee_number' => ($asset->assigned->employee_num) ? e($asset->assigned->employee_num) : null, 'employee_number' => ($asset->assigned->employee_num) ? e($asset->assigned->employee_num) : null,
'type' => 'user', 'type' => 'user',
'eula_pdf' => e($asset->lastAcceptedLog->last()->filename), 'eula_pdf' => e($asset->acceptanceLog->last()->filename),
'signature_file' => e($asset->lastAcceptedLog->last()->accept_signature), 'signature_file' => e($asset->acceptanceLog->last()->accept_signature),
] : null; ] : null;
} }

View file

@ -596,7 +596,7 @@ class Asset extends Depreciable
* @since [v6.0.14] * @since [v6.0.14]
* @return \Illuminate\Database\Eloquent\Relations\Relation * @return \Illuminate\Database\Eloquent\Relations\Relation
*/ */
public function lastAcceptedLog() public function acceptanceLog()
{ {
return $this->hasMany(\App\Models\Actionlog::class, 'item_id') return $this->hasMany(\App\Models\Actionlog::class, 'item_id')
->where('item_type', '=', self::class) ->where('item_type', '=', self::class)