first(); if (!$found_server) { throw new \RuntimeException('Server not found.'); } $found_team = auth()->user()->teams->pluck('id')->contains($found_server->team_id); if (!$found_team) { throw new \RuntimeException('You do not have access to this server.'); } return resolve(DispatchRemoteProcess::class, [ 'remoteProcessArgs' => new RemoteProcessArgs( destination: $found_server->ip, command: $command, port: $found_server->port, user: $found_server->user, ), ])(); } }