New method to get latest signature event

This makes the print page much tidier.
This commit is contained in:
36864 2025-04-11 16:28:54 +00:00 committed by GitHub
parent 06fc140626
commit 3b314086f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -343,4 +343,24 @@ trait Loggable
return $log; return $log;
} }
/**
* Get latest signature from a specific user
*
* This just makes the print view a bit cleaner
* Returns the latest acceptance ActionLog that contains a signature
* from $user or null if there is none
*
* @param User $user
* @return null|Actionlog
**/
public function getLatestSignedAcceptance(User $user)
{
return $this->log->where('target_type', User::class)
->where('target_id', $user->id)
->where('action_type', 'accepted')
->where('accept_signature', '!=', null)
->sortByDesc('created_at')
->first();
}
} }