Logger by Z3d0X - How to display the "old" properties (key/value) in the view?

Hi, I'm implementing https://filamentphp.com/plugins/logger. Any advice to get the "old" properties in the "view" page? I want to show it like it is now and also the old properties before the activity. Thanks...
5 Replies
ZedoX
ZedoX17mo ago
1) Disable resource logger from the config 2) Enable model logging from spatie's package
Pablo Torres
Pablo TorresOP17mo ago
Just to say thank you so much. It's working... For anyone that may need extra help, here is what I did... On filament-logger.php:
'resources' => [
'enabled' => false, // false to disable it as per ZedoX point 1
'log_name' => 'Resource',
'logger' => \Z3d0X\FilamentLogger\Loggers\ResourceLogger::class,
'color' => 'success',
'exclude' => [
//App\Filament\Resources\UserResource::class,
],
],
'resources' => [
'enabled' => false, // false to disable it as per ZedoX point 1
'log_name' => 'Resource',
'logger' => \Z3d0X\FilamentLogger\Loggers\ResourceLogger::class,
'color' => 'success',
'exclude' => [
//App\Filament\Resources\UserResource::class,
],
],
On my model:
use Spatie\Activitylog\Traits\LogsActivity;
use Spatie\Activitylog\LogOptions;

class Comment extends Model
{
use HasFactory, LogsActivity;

protected $fillable = [
'user_id',
'business_id',
'title',
'slug',
'content',
];

public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults()
->logOnly(['title', 'slug', 'content']);
}
use Spatie\Activitylog\Traits\LogsActivity;
use Spatie\Activitylog\LogOptions;

class Comment extends Model
{
use HasFactory, LogsActivity;

protected $fillable = [
'user_id',
'business_id',
'title',
'slug',
'content',
];

public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults()
->logOnly(['title', 'slug', 'content']);
}
Now my view shows old and new properties. Brillant, thanks Note. As the resource logger from the config is now disabled you'll need to update all other models. @z3d0x please correct me if I'm wrong.
salma
salma8mo ago
it shows the attribute names as its written in the database, how i can add label for it ? @Pablo Torres @ZedoX
ZedoX
ZedoX8mo ago
Not sure if that's possible 🤔
Want results from more Discord servers?
Add your server