46 lines
1.8 KiB
PHP
46 lines
1.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Filament\Resources\ActivityLogs\Schemas;
|
|
|
|
use Filament\Infolists\Components\KeyValueEntry;
|
|
use Filament\Infolists\Components\TextEntry;
|
|
use Filament\Schemas\Components\Section;
|
|
use Filament\Schemas\Schema;
|
|
|
|
class ActivityLogInfolist
|
|
{
|
|
public static function configure(Schema $schema): Schema
|
|
{
|
|
return $schema
|
|
->components([
|
|
Section::make('Activity Details')
|
|
->schema([
|
|
TextEntry::make('created_at')
|
|
->label('Date')
|
|
->dateTime(),
|
|
TextEntry::make('description'),
|
|
TextEntry::make('event')
|
|
->badge(),
|
|
TextEntry::make('log_name')
|
|
->label('Log Name'),
|
|
TextEntry::make('subject_type')
|
|
->label('Subject Type')
|
|
->formatStateUsing(fn (?string $state): string => $state ? class_basename($state) : '—'),
|
|
TextEntry::make('subject_id')
|
|
->label('Subject ID'),
|
|
TextEntry::make('causer.name')
|
|
->label('Causer'),
|
|
KeyValueEntry::make('properties.attributes')
|
|
->label('Changes')
|
|
->visible(fn ($record): bool => filled($record->properties['attributes'] ?? null)),
|
|
KeyValueEntry::make('properties.old')
|
|
->label('Previous Values')
|
|
->visible(fn ($record): bool => filled($record->properties['old'] ?? null)),
|
|
])
|
|
->columns(2),
|
|
]);
|
|
}
|
|
}
|