Feature: Data Access and Data Export Admin Service

This commit introduces the data retention and data export Admin Services, accessed by the Boboko admin UI
This commit is contained in:
2026-08-25 09:33:03 +03:00
parent 59303cf25f
commit e7784364fd
13 changed files with 800 additions and 0 deletions
+22
View File
@@ -79,4 +79,26 @@ class DataErasureRequest extends Model
{
return $this->isPending() && $this->scheduled_for->isPast();
}
/**
* A human-readable label for whichever record `$morphable` resolves to
* (Customer, User, or Staff — the three concrete types that appear across
* subject/requestedBy), since each uses a different name field and there's
* no shared interface for it. Falls back to "#id" if the record is gone
* (e.g. a Customer erased since this request completed) or the relation is
* simply empty.
*/
public static function displayNameFor(mixed $morphable): string
{
if (! $morphable) {
return '—';
}
return match (true) {
isset($morphable->full_name) => $morphable->full_name,
isset($morphable->name) => $morphable->name,
isset($morphable->first_name) => trim("{$morphable->first_name} {$morphable->last_name}"),
default => "#{$morphable->getKey()}",
};
}
}