plainKey = $plainKey; return $instance; } public function toArray(Request $request): array { return [ 'id' => $this->id, 'name' => $this->name, 'prefix' => $this->prefix, 'scopes' => $this->scopes, 'last_used_at' => $this->last_used_at?->toIso8601String(), 'expires_at' => $this->expires_at?->toIso8601String(), 'created_at' => $this->created_at->toIso8601String(), // Only included on creation 'key' => $this->when($this->plainKey !== null, $this->plainKey), // Masked display key 'display_key' => $this->masked_key, ]; } }