Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not saving Auth user information when I use with model operations. #1264

Open
jishadp opened this issue Jan 18, 2024 · 1 comment
Open

Not saving Auth user information when I use with model operations. #1264

jishadp opened this issue Jan 18, 2024 · 1 comment
Labels

Comments

@jishadp
Copy link

jishadp commented Jan 18, 2024

This is my code in Country Model

public function getActivitylogOptions(): LogOptions
{
    $user = auth()->user();
    return LogOptions::defaults()
    ->logUnguarded();
}

Log saving perfectly, bu the causer_type, causer_id is insert as null.

I need those columns with my auth id

Please help me to solve this issue.

@jishadp jishadp added the bug label Jan 18, 2024
@StevePorter92
Copy link
Contributor

You can use the causer resolver to set this globally. Checkout some more info below
https://spatie.be/docs/laravel-activitylog/v4/api/causer-resolver
https://spatie.be/docs/laravel-activitylog/v4/advanced-usage/define-causer-for-runtime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants