resolvePushModel('PushWebsite'); if (! $class) { return null; } return $this->hasMany($class); } /** * Get all push campaigns owned by this user. */ public function pushCampaigns(): ?HasMany { $class = $this->resolvePushModel('PushCampaign'); if (! $class) { return null; } return $this->hasMany($class); } /** * Get all push segments owned by this user. */ public function pushSegments(): ?HasMany { $class = $this->resolvePushModel('PushSegment'); if (! $class) { return null; } return $this->hasMany($class); } /** * Get all push flows owned by this user. */ public function pushFlows(): ?HasMany { $class = $this->resolvePushModel('PushFlow'); if (! $class) { return null; } return $this->hasMany($class); } /** * Resolve a Push model class, checking common namespaces. */ protected function resolvePushModel(string $model): ?string { $candidates = [ "Core\\Mod\\Push\\Models\\{$model}", "App\\Models\\{$model}", ]; foreach ($candidates as $candidate) { if (class_exists($candidate)) { return $candidate; } } return null; } }