Before middleware order

Hello,

I have application middleware and route-middleware. I will only use before-middleware. I noticed that the order is :
1 application-middleware
2 route-middleware(in groups from less nested to most nested )

Is there a way to change this order? For example the authentication-middleware I want to put on the less-nested-route-group and the authorization on the most-nested-route-group. Because this differs the most per route-group.

                 $group->group(
                        'invitations',
                        function (Group $group): void {                            
                            $group->options('/{invitationId}', InvitationAction::class . ':options');
                            $group->put('/{invitationId}', InvitationAction::class . ':edit');
                        }
                    )->add( InvitationAuthorizationMiddleware::class );
                
                     $group->group(
                        'planningconfigs',
                        function (Group $group): void {
                            $group->options('', PlanningConfigAction::class . ':options');
                            $group->post('', PlanningConfigAction::class . ':add');
                        })->add( PlanningConfigAuthorizationMiddleware::class );

        })->add( AuthenticationMiddleware::class );

I think it will only work per group and not for the sub-groups, because Slim uses a Last In, First Out (LIFO) model for middleware.

$group->group('invitations', function (Group $group): void {
    $group->options('/{invitationId}', InvitationAction::class . ':options');
    $group->put('/{invitationId}', InvitationAction::class . ':edit');
})->add(AuthenticationMiddleware::class)
    ->add(InvitationAuthorizationMiddleware::class);

$group->group('planningconfigs', function (Group $group): void {
    $group->options('', PlanningConfigAction::class . ':options');
    $group->post('', PlanningConfigAction::class . ':add');
})->add(AuthenticationMiddleware::class)
    ->add(PlanningConfigAuthorizationMiddleware::class);