*/ public function toArray(Request $request): array { return [ 'id' => $this->id, 'name' => $this->name, 'prefix' => $this->prefix, 'abilities' => $this->abilities ?? [], 'owner' => ['id' => $this->user_id, 'name' => $this->user?->name], 'status' => match (true) { $this->revoked_at !== null => 'revoked', $this->expires_at->isPast() => 'expired', default => 'active', }, 'expires_at' => $this->expires_at->toIso8601String(), 'last_used_at' => $this->last_used_at?->toIso8601String(), 'revoked_at' => $this->revoked_at?->toIso8601String(), 'created_at' => $this->created_at?->toIso8601String(), ]; } }