*/ public function toArray(Request $request): array { return [ 'id' => $this->id, 'tenant_id' => $this->tenant_id, 'name' => $this->name, 'description' => $this->description, 'is_system' => (bool) $this->is_system, 'is_active' => (bool) $this->is_active, 'tenant' => $this->whenLoaded('tenant', fn () => $this->tenant ? [ 'id' => $this->tenant->id, 'tenant_code' => $this->tenant->tenant_code, 'tenant_name' => $this->tenant->tenant_name, ] : null), 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, ]; } }