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

Laravel 11 didnt register activity #1284

Open
MaximilianoHitter opened this issue Mar 16, 2024 · 1 comment
Open

Laravel 11 didnt register activity #1284

MaximilianoHitter opened this issue Mar 16, 2024 · 1 comment
Labels

Comments

@MaximilianoHitter
Copy link

MaximilianoHitter commented Mar 16, 2024

Describe the bug
Already installed activity log into a laravel 11 new proyect, use the same estructure like i used in a laravel 10 proyect, bue get no errors in laravel log and not even using x-debug.

To Reproduce
Install package, generate the following trait

`<?php

namespace App\Models\Traits;

use Spatie\Activitylog\LogOptions;

trait LogsActivity
{
use \Spatie\Activitylog\Traits\LogsActivity;

public function getDescriptionForEvent(string $eventName): string
{
    $arr = ['updated' => 'actualizado', 'created' => 'creado', 'deleted' => 'eliminado'];
    $rta = $arr[$eventName];

    return "Este modelo ha sido {$rta}";
}

public function getActivitylogOptions(): LogOptions
{
    $config = LogOptions::defaults();
    $config->logOnlyDirty();
    $config->logExcept(['created_at', 'updated_at']);
    $config->logOnly(['*']);

    return $config;
}

}
`
And add in models this trait

Expected behavior
Get activity when create, update or delete model

Versions (please complete the following information)

  • PHP: 8.3.3
  • Database: MySQL 8.0
  • Laravel: 11.0.7
  • Package: spatie/activity-log
@seth9009
Copy link

seth9009 commented Apr 6, 2024

got the same problem on Laravel 11

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