From 875d6409cb7052e5488479781710206a43d84cd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Tue, 3 Jun 2025 01:55:26 +0200 Subject: [PATCH] phpstan --- src/Actions/CloneRoutesAsTenant.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Actions/CloneRoutesAsTenant.php b/src/Actions/CloneRoutesAsTenant.php index c6982a99..38841d24 100644 --- a/src/Actions/CloneRoutesAsTenant.php +++ b/src/Actions/CloneRoutesAsTenant.php @@ -129,7 +129,11 @@ class CloneRoutesAsTenant // Make the new route have the same middleware as the original route // Add the 'tenant' middleware to the new route // Exclude $this->cloneRoutesWithMiddleware MW from the new route (it should only be flagged as tenant) - $middleware = collect($action->get('middleware') ?? []) + + /** @var array $middleware */ + $middleware = $action->get('middleware') ?? []; + + $middleware = collect($middleware) ->merge(['tenant']) // Add 'tenant' flag // todo0 what if 'clone' is within some middleware group - not top level? this should be handled similarly // to tenancy()->routeHasMiddleware() - use the same traversal depth. only issue is that in such a case, we