Skip to content

Grouping the audited model's relation #966

Closed Answered by thevalo
thevalo asked this question in Q&A
Discussion options

You must be logged in to vote

After abusing few of my brain cells, I think I found a solution.

For anyone who needs this in the future:
in the config/audits.php:

    'resolvers' => [
        'ip_address' => OwenIt\Auditing\Resolvers\IpAddressResolver::class,
        'user_agent' => OwenIt\Auditing\Resolvers\UserAgentResolver::class,
        'url'        => OwenIt\Auditing\Resolvers\UrlResolver::class,
        'event_sequence_id' => \App\AuditResolvers\EventSequenceId::class,
    ],

And the resolver itself:

class EventSequenceId implements Resolver
{
    public static function resolve(Auditable $auditable)
    {
        $idKey = $auditable instanceof Invoice ? $auditable->id : $auditable->invoice->id;
        return s…

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by thevalo
Comment options

You must be logged in to vote
6 replies
@parallels999
Comment options

@thevalo
Comment options

@parallels999
Comment options

@thevalo
Comment options

@thevalo
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants