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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user