Add bokshorn-it/filament-activity-timeline package for enhanced audit logging functionality. Update README to reflect new key package and improve localization for audit-related terms. Remove deprecated ActivityLogResource and related pages, integrating activity timeline features into existing resources. Update models to implement ProvidesActivityTitle for better activity tracking.

This commit is contained in:
Mekan1206
2026-08-02 22:37:59 +05:00
parent 0237c2b9ef
commit 3504e39646
46 changed files with 472 additions and 314 deletions

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Models\Concerns;
use BokshornIt\FilamentActivityTimeline\Contracts\ProvidesActivityTitle;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity;
@@ -18,4 +19,29 @@ trait LogsHrActivity
->logOnlyDirty()
->dontSubmitEmptyLogs();
}
public function activityTitle(): ?string
{
foreach (['full_name', 'name', 'title', 'gift_name', 'employee_number'] as $attribute) {
$value = $this->getAttribute($attribute);
if (filled($value)) {
return (string) $value;
}
}
if ($this->getAttribute('employee_id')) {
$employeeName = $this->relationLoaded('employee')
? $this->employee?->full_name
: $this->employee()->value('full_name');
if (filled($employeeName)) {
return (string) $employeeName;
}
}
$key = $this->getKey();
return $key !== null ? '#'.$key : null;
}
}