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