authorizeCurrentWorkspace( $request, 'manageAccounts', 'Not authorized to manage social accounts.', ); if (! $workspace instanceof Workspace) { return $workspace; } $validated = $request->validate([ 'account_id' => ['required', 'string', 'uuid'], ]); $account = SocialAccount::where('workspace_id', $workspace->id) ->find(data_get($validated, 'account_id')); if (! $account) { return Response::error('Social account not found.'); } $account = ToggleSocialAccount::execute($account); return Response::structured((new SocialAccountResource($account))->resolve()); } public function schema(JsonSchema $schema): array { return [ 'account_id' => $schema->string()->required()->description('The UUID of the social account to toggle.'), ]; } }